]> pd.if.org Git - zpackage/blobdiff - elf/elftype.c
remove stray debug fprintf
[zpackage] / elf / elftype.c
index d9b253a2249458208fb82e642d489610eb82a285..717dc122743b4492b935829a418b2d939c59afe0 100644 (file)
@@ -16,7 +16,7 @@
 #define SYMLINKS    0x10
 
 int readline(FILE *f, char *fn);
-int checkfile(char *fn, unsigned int want, int perr, int quiet);
+int checkfile(char *fn, unsigned int want, int perr);
 
 int errors = 0;
 int zeroterm = 0;
@@ -24,7 +24,6 @@ int zeroterm = 0;
 int main(int ac, char **av) {
        int option;
        unsigned int want = 0;
-       int quiet = 0;
        int printtype = 0;
        int printname = 0;
        int verbose = 0;
@@ -32,7 +31,7 @@ int main(int ac, char **av) {
        FILE *list = 0;
        char fn[PATH_MAX];
        
-       while ((option = getopt(ac, av, "vtnredclaqp0f:")) != -1) {
+       while ((option = getopt(ac, av, "vtnredclap0f:")) != -1) {
                switch (option) {
                        case 'r': want |= RELOCATABLE; break;
                        case 'e': want |= EXECUTABLE; break;
@@ -40,7 +39,6 @@ int main(int ac, char **av) {
                        case 'c': want |= CORE; break;
                        case 'l': want |= SYMLINKS; break;
                        case 'a': want = (RELOCATABLE|EXECUTABLE|DYNAMIC|CORE); break;
-                       case 'q': quiet++; break;
                        case 't': printtype++; break;
                        case 'n': printname++; break;
                        case 'v': verbose++; break;
@@ -63,10 +61,9 @@ int main(int ac, char **av) {
 
        if (list) {
                int type;
-               quiet = 2;
                perr = 0;
                while (readline(list, fn)) {
-                       if ((type = checkfile(fn, want,perr,quiet)) & want) {
+                       if ((type = checkfile(fn, want, perr)) & want) {
                                if (printtype) {
                                        switch (type) {
                                                case RELOCATABLE:
@@ -90,7 +87,7 @@ int main(int ac, char **av) {
 
                fn = av[optind];
                if (verbose) fprintf(stderr, "checking %s\n", av[optind]);
-               type = checkfile(fn,want,perr,quiet);
+               type = checkfile(fn,want,perr);
 
                if (printtype) {
                        switch (type) {
@@ -147,7 +144,7 @@ int readline(FILE *f, char *fn) {
        return 0;
 }
 
-int checkfile(char *fn, unsigned int want, int perr, int quiet) {
+int checkfile(char *fn, unsigned int want, int perr) {
        Elf64_Ehdr hdr;
        int fd, bytes;
        int endian = 0;
@@ -170,7 +167,7 @@ int checkfile(char *fn, unsigned int want, int perr, int quiet) {
        }
        bytes = read(fd, &hdr, sizeof hdr);
        close(fd);
-       if (bytes < sizeof hdr) {
+       if ((size_t)bytes < sizeof hdr) {
                if (perr) fprintf(stderr, "could not read full elf header (wanted %zu got %d bytes)\n", sizeof hdr, bytes);
                return 0;
        }