]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commitdiff
libxl: avoid infinite loop in libxl__remove_directory()
authorJan Beulich <jbeulich@suse.com>
Thu, 20 Mar 2025 12:34:15 +0000 (13:34 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 20 Mar 2025 12:34:15 +0000 (13:34 +0100)
Infinitely retrying the rmdir() invocation makes little sense. While the
original observation was the log filling the disk (due to repeated
"Directory not empty" errors, in turn occurring for unclear reasons),
the loop wants breaking even if there was no error message being logged
(much like is done in the similar loops in libxl__remove_file() and
libxl__remove_file_or_directory()).

Fixes: c4dcbee67e6d ("libxl: provide libxl__remove_file et al")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Anthony PERARD <anthony.perard@vates.tech>
master commit: 68baeb5c4852e652b9599e049f40477edac4060e
master date: 2025-03-13 10:23:10 +0100

tools/libs/light/libxl_utils.c

index e403bd9bcf6acae4f6ededb6141cdcd11de27af9..65ef196935704fc0244bfd6abe483edbe5af005f 100644 (file)
@@ -575,6 +575,7 @@ int libxl__remove_directory(libxl__gc *gc, const char *dirpath)
         if (errno == EINTR) continue;
         LOGE(ERROR, "failed to remove emptied directory %s", dirpath);
         rc = ERROR_FAIL;
+        break;
     }
 
  out: