Error out if scandir() runs into trouble.

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-11 
14:46:09.000000000 +0900
+++ kexec-tools-testing/kexec/arch/ppc64/fs2dt.c        2006-12-11 
14:46:15.000000000 +0900
@@ -329,9 +329,12 @@
                dt++;
 
        numlist = scandir(pathname, &namelist, 0, comparefunc);
-       if (numlist == 0)
+       if (numlist < 0)
                die("unrecoverable error: could not scan \"%s\": %s\n",
                    pathname, strerror(errno));
+       if (numlist == 0)
+               die("unrecoverable error: no directory entries in \"%s\"",
+                   pathname);
 
        basename = strrchr(pathname,'/');
 

--

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

_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot

Reply via email to