diff options
author | Horms <horms@verge.net.au> | 2006-12-11 14:25:56 +0900 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2006-12-12 17:55:49 +0900 |
commit | e358b3ee211e0794cf5a6122b4db93198e0fdf40 (patch) | |
tree | a89ad7867c8ec3bc5b5ad704bc44dd227997dbd5 /kexec | |
parent | 6a33ef415ec36725eb307adc3666852155a0d7bf (diff) |
kexec-tools: Detect scandir errors
Error out if scandir() runs into trouble.
Signed-off-by: Simon Horman <horms@verge.net.au>
Makes sense. Tested and working fine. Ack.
Acked-by: Sachin P. Sant <sachinp@in.ibm.com>
Diffstat (limited to 'kexec')
-rw-r--r-- | kexec/arch/ppc64/fs2dt.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kexec/arch/ppc64/fs2dt.c b/kexec/arch/ppc64/fs2dt.c index 8e24f18..bdb6d5a 100644 --- a/kexec/arch/ppc64/fs2dt.c +++ b/kexec/arch/ppc64/fs2dt.c @@ -326,9 +326,12 @@ static void putnode(void) 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,'/'); |