From: Kevin Day Date: Thu, 20 Aug 2020 02:18:22 +0000 (-0500) Subject: Bugfix: directory remove is not handling all errors. X-Git-Tag: 0.5.0~46 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=278b9a4e5d6b8588346b787e09085071d0957d23;p=fll Bugfix: directory remove is not handling all errors. The errno ENOTEMPTY is not being handled and is now added. The errno EOVERFLOW is not used and is now removed. Update the relevant documentation. --- diff --git a/level_0/f_directory/c/directory.c b/level_0/f_directory/c/directory.c index de23fc8..82ff60f 100644 --- a/level_0/f_directory/c/directory.c +++ b/level_0/f_directory/c/directory.c @@ -290,9 +290,9 @@ extern "C" { if (errno == ENOENT) return F_status_set_error(F_file_found_not); if (errno == ENOMEM) return F_status_set_error(F_memory_out); if (errno == ENOTDIR) return F_status_set_error(F_directory); + if (errno == ENOTEMPTY) return F_status_set_error(F_directory_empty_not); if (errno == EPERM) return F_status_set_error(F_prohibited); if (errno == EROFS) return F_status_set_error(F_read_only); - if (errno == EOVERFLOW) return F_status_set_error(F_number_overflow); return F_status_set_error(F_failure); } @@ -337,7 +337,7 @@ extern "C" { if (errno == ENOENT) return F_status_set_error(F_file_found_not); if (errno == ENOMEM) return F_status_set_error(F_memory_out); if (errno == ENOTDIR) return F_status_set_error(F_directory); - if (errno == EOVERFLOW) return F_status_set_error(F_number_overflow); + if (errno == ENOTEMPTY) return F_status_set_error(F_directory_empty_not); if (errno == EPERM) return F_status_set_error(F_prohibited); if (errno == EROFS) return F_status_set_error(F_read_only); diff --git a/level_0/f_directory/c/directory.h b/level_0/f_directory/c/directory.h index 69104b5..9277ab2 100644 --- a/level_0/f_directory/c/directory.h +++ b/level_0/f_directory/c/directory.h @@ -394,6 +394,7 @@ extern "C" { * F_access_denied (with error bit) on access denied. * F_busy (with error bit) if file is busy. * F_directory (with error bit) if a supposed directory in path is not actually a directory. + * F_directory_empty_not (with error bit) if the directory is not empty. * F_file_descriptor_max (with error bit) if max file descriptors was reached. * F_file_found_not (with error bit) if file not found. * F_file_open_max (with error bit) too many open files. @@ -405,7 +406,6 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_prohibited (with error bit) if filesystem does not allow for removing. * F_read_only (with error bit) if file is read-only. - * F_number_overflow (with error bit) on integer overflow. * F_failure (with error bit) for any other error. * * @see nftw() @@ -436,7 +436,10 @@ extern "C" { * F_access_denied (with error bit) on access denied. * F_busy (with error bit) if file is busy. * F_directory (with error bit) if a supposed directory in path is not actually a directory. + * F_directory_empty_not (with error bit) if the directory is not empty. + * F_file_descriptor_max (with error bit) if max file descriptors was reached. * F_file_found_not (with error bit) if file not found. + * F_file_open_max (with error bit) too many open files. * F_file_type_directory (with error bit) file is a directory (directories cannot be removed via this function). * F_input_output (with error bit) if an I/O error occurred. * F_loop (with error bit) on loop error.