mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-25 23:52:17 +00:00
btrfs-progs: check for fstat failure in cmd_defrag
Resolves-Coverity-CID: 1125924 Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
parent
e11712a146
commit
b68477aee1
@ -681,7 +681,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);
|
||||
|
Loading…
Reference in New Issue
Block a user