]> pd.if.org Git - zpackage/blobdiff - elf/soname.c
add warnings to compile flags and fix
[zpackage] / elf / soname.c
index 8b6c451275f8a8e42d8f50cb58b028d380a7cc07..06e56624eaccffbf30a8d928e09678127def7c13 100644 (file)
@@ -23,6 +23,11 @@ int main(int ac, char **av) {
        char *name, *dynname;
        Elf64_Dyn *dent;
 
+       if (ac < 2) {
+               fprintf(stderr, "usage: soname <file>\n");
+               exit(EXIT_FAILURE);
+       }
+
        if (lstat(av[1], &sbuf) == -1) {
                exit(1);
        }
@@ -42,7 +47,7 @@ int main(int ac, char **av) {
                exit(1);
        }
        /* not at least the size of the elf header? */
-       if (sbuf.st_size < sizeof(Elf64_Ehdr)) {
+       if ((size_t)sbuf.st_size < sizeof(Elf64_Ehdr)) {
                exit(1);
        }