Message ID | 1383779755-18228-15-git-send-email-sandeen@redhat.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
diff --git a/cmds-filesystem.c b/cmds-filesystem.c index b1291d6..2cb067d 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -661,7 +661,13 @@ static int cmd_defrag(int argc, char **argv) if (recursive) { struct stat st; - fstat(fd, &st); + if (fstat(fd, &st)) { + fprintf(stderr, "ERROR: failed to stat %s - %s\n", + argv[i], strerror(errno)); + defrag_global_errors++; + close_file_or_dir(fd, dirstream); + continue; + } if (S_ISDIR(st.st_mode)) { ret = nftw(argv[i], defrag_callback, 10, FTW_MOUNT | FTW_PHYS);
Resolves-Coverity-CID: 1125924 Signed-off-by: Eric Sandeen <sandeen@redhat.com> --- cmds-filesystem.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)