utils: minor fixes and changes
authorAlan Cox <alan@linux.intel.com>
Sun, 13 Nov 2016 00:08:17 +0000 (00:08 +0000)
committerAlan Cox <alan@linux.intel.com>
Sun, 13 Nov 2016 00:08:17 +0000 (00:08 +0000)
chmod we switch to opendir because we can't handle big stack objects on a
6502, and our newer malloc is way smaller so it's not a big hit any more

Applications/util/chmod.c
Applications/util/dd.c
Applications/util/decomp16.c

index 82effc7..276cb15 100644 (file)
@@ -210,7 +210,7 @@ int main(int argc, char *argv[])
 int do_change(char *name)
 {
     mode_t m;
-    DIR dir;
+    DIR *dir;
     struct dirent *entp;
     char *namp;
 
@@ -235,7 +235,7 @@ int do_change(char *name)
     }
 
     if (S_ISDIR(st.st_mode) && rflag) {
-       if (!opendir_r(&dir, name)) {
+       if ((dir = opendir(name)) == NULL) {
            perror(name);
            return (1);
        }
@@ -243,14 +243,14 @@ int do_change(char *name)
            strcpy(path, name);
        namp = path + strlen(path);
        *namp++ = '/';
-       while (entp = readdir(&dir))
+       while (entp = readdir(dir))
            if (entp->d_name[0] != '.' ||
                (entp->d_name[1] &&
                 (entp->d_name[1] != '.' || entp->d_name[2]))) {
                strcpy(namp, entp->d_name);
                errors |= do_change(path);
            }
-       closedir_r(&dir);
+       closedir(dir);
        *--namp = '\0';
     }
     return (errors);
index d1f9488..638c7cf 100644 (file)
@@ -126,7 +126,7 @@ int main(int argc, char *argv[])
            count = getnum(cp);
            if (count < 0) {
                fprintf(stderr, "Bad count value\n");
-               return;
+               return 1;
            }
            break;
 
index cd9fb4a..a3f118c 100644 (file)
@@ -175,7 +175,7 @@ void die(const char *s)
   /* Write any error message */
   if (s != (const char *) NULL)
        write(fderr, s, strlen(s));
-  exit((s == (char *) NULL) ? 0 : 1);
+  exit((s == (const char *) NULL) ? 0 : 1);
 }
 
 
@@ -438,4 +438,5 @@ int main(int argc, char *argv[])
                }
        }
   }
+  return 0;
 }