kexec-tools: ppc64: tidy up use of statbuf

* statbuf does not need to be global
* statbuf does not need to be an array

Signed-Off-By: Simon Horman <[EMAIL PROTECTED]>

Index: kexec-tools-testing/kexec/arch/ppc64/fs2dt.c
===================================================================
--- kexec-tools-testing.orig/kexec/arch/ppc64/fs2dt.c   2006-12-08 
11:30:33.000000000 +0900
+++ kexec-tools-testing/kexec/arch/ppc64/fs2dt.c        2006-12-08 
16:38:39.000000000 +0900
@@ -58,7 +58,6 @@
 }
 
 typedef unsigned dvt;
-struct stat statbuf[1];
 char pathname[MAXPATH], *pathstart;
 char propnames[NAMESPACE];
 dvt dtstruct[TREEWORDS], *dt;
@@ -196,6 +195,7 @@
 {
        struct dirent *dp;
        int i = 0, fd, len;
+       struct stat statbuf;
 
        for (i = 0; i < numlist; i++) {
                dp = nlist[i];
@@ -204,7 +204,7 @@
                if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
                         continue;
 
-               if (lstat(pathname, statbuf))
+               if (lstat(pathname, &statbuf))
                        err(pathname, ERR_STAT);
 
                if (!crash_param && !strcmp(fn,"linux,crashkernel-base"))
@@ -230,10 +230,10 @@
                        !strcmp(dp->d_name, "linux,initrd-end"))
                                continue;
 
-               if (! S_ISREG(statbuf[0].st_mode))
+               if (! S_ISREG(statbuf.st_mode))
                        continue;
 
-               len = statbuf[0].st_size;
+               len = statbuf.st_size;
 
                *dt++ = 3;
                dt_len = dt;
@@ -331,6 +331,7 @@
        char *basename;
        struct dirent **namelist;
        int numlist, i;
+       struct stat statbuf;
 
        *dt++ = 1;
        strcpy((void *)dt, *pathstart ? pathstart : "/");
@@ -389,10 +390,10 @@
                if (!strcmp(dn, ".") || !strcmp(dn, ".."))
                        continue;
 
-               if (lstat(pathname, statbuf))
+               if (lstat(pathname, &statbuf))
                        err(pathname, ERR_STAT);
 
-               if (S_ISDIR(statbuf[0].st_mode))
+               if (S_ISDIR(statbuf.st_mode))
                        putnode();
        }
        if (errno)

--

-- 
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/

_______________________________________________
fastboot mailing list
fastboot@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/fastboot

Reply via email to