df: move big buffers off stack
authorAlan Cox <alan@linux.intel.com>
Sun, 13 Nov 2016 00:09:40 +0000 (00:09 +0000)
committerAlan Cox <alan@linux.intel.com>
Sun, 13 Nov 2016 00:09:40 +0000 (00:09 +0000)
Applications/util/df.c

index 5ef983a..d81bfa4 100644 (file)
@@ -143,10 +143,11 @@ void df_all(void)
 
 const char *devname(dev_t devno)
 {
-    DIR dp;
+    static char namebuf[sizeof(DEV_PATH) + MAXNAMLEN + 2];
+    static DIR dp;
+
     struct dirent *entry;
     struct stat fstat;
-    static char namebuf[sizeof(DEV_PATH) + MAXNAMLEN + 2];
 
     if (opendir_r(&dp, DEV_PATH) != (DIR *) NULL) {
         while ((entry = readdir(&dp)) != (struct dirent *) NULL) {