This patch fixes the problem of empty directories being left in the /dev/evms tree. --- evms-2.5.1/engine/discover.c 2004-12-20 16:40:17.000000000 -0600 +++ evms-2.5.1-fix/engine/discover.c 2005-01-28 10:20:19.000000000 -0600 @@ -2584,6 +2584,7 @@ struct dirent * dir_ent; char name_buf[PATH_MAX]; int dir_path_len; + boolean dir_empty = TRUE; LOG_PROC_ENTRY(); @@ -2627,8 +2628,8 @@ cleanup_empty_dirs(name_buf); /* - * If the sub directory was empty it will have - * benn deleted. Check if it is still there. + * If the subdirectory was empty it will have + * been deleted. Check if it is still there. */ if (stat(name_buf, &stat_buf) != 0) { @@ -2644,23 +2645,27 @@ /* * The subdirectory is still there. * This directory is not empty. - * We're finished. */ - break; + dir_empty = FALSE;; } - } - } else { - /* - * It's not a subdirectory. Something else is in this - * directory. It's not empty. We're finished. - */ - break; + } else { + /* + * It's not a subdirectory. Something else is + * in this directory. It's not empty. + */ + dir_empty = FALSE;; + } } } closedir(dir); + if (dir_empty) { + LOG_DEBUG("Removing empty directory %s.\n", dir_name); + rmdir(dir_name); + } + LOG_PROC_EXIT_VOID(); return; } @@ -2730,7 +2735,7 @@ engine_free(dev_nodes); - cleanup_empty_dirs(EVMS_DIR_NAME); + cleanup_empty_dirs(EVMS_DEV_NODE_DIR); status_message(_("Finished cleaning up the /dev/evms tree.\n"));