From: Kent Overstreet Date: Mon, 15 Jan 2024 19:34:54 +0000 (-0500) Subject: cmd_attr: check for errors from fdopendir() X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=76161e068740fec0849b61e254a3831781cead43;p=bcachefs-tools-debian cmd_attr: check for errors from fdopendir() Signed-off-by: Kent Overstreet --- diff --git a/cmd_attr.c b/cmd_attr.c index 9e7f563..bde9d8f 100644 --- a/cmd_attr.c +++ b/cmd_attr.c @@ -16,6 +16,11 @@ static void propagate_recurse(int dirfd) DIR *dir = fdopendir(dirfd); struct dirent *d; + if (!dir) { + fprintf(stderr, "fdopendir() error: %m\n"); + return; + } + while ((errno = 0), (d = readdir(dir))) { if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))