1
1

Fix a logic error and typo that were keeping files in the session dir tree alive - now can truly "woo-hoo".

This commit was SVN r2371.
Этот коммит содержится в:
Ralph Castain 2004-08-29 06:50:00 +00:00
родитель 671a3de019
Коммит ee75ce35cd
2 изменённых файлов: 26 добавлений и 20 удалений

Просмотреть файл

@ -39,6 +39,7 @@
#include "util/sys_info.h"
#include "util/proc_info.h"
#include "util/output.h"
#include "util/os_path.h"
#include "util/os_create_dirpath.h"
#include "util/session_dir.h"
@ -241,29 +242,14 @@ ompi_clean_dir(char *pathname)
if ((0 != strcmp(ep->d_name, ".")) &&
(0 != strcmp(ep->d_name, "..")) &&
(DT_DIR != ep->d_type)) {
filenm = ompi_os_path(true, pathname, ep->d_name, NULL);
if (!unlink(filenm)) {
if (ENOENT == errno) { /* file doesn't exist - race condition */
/* ignore this */
} else if (EBUSY == errno) { /* someone using it */
/* left in for diag purposes - should print something */
/* otherwise, normally just report error */
} else { /* no idea what to do - punt */
return OMPI_ERROR;
}
}
filenm = ompi_os_path(false, pathname, ep->d_name, NULL);
unlink(filenm);
}
}
if (!rmdir(pathname)) { /* error */
if (EEXIST == errno || ENOTEMPTY == errno) { /* not empty */
} else if (ENOENT == errno || EBUSY == errno) { /* doesn't exist or busy - race condition */
/* put in diagnostic message for now */
} else { /* no idea */
}
}
return OMPI_SUCCESS;
closedir(dp);
}
return OMPI_ERROR;
rmdir(pathname);
return OMPI_SUCCESS;
}
return OMPI_ERROR;
}

Просмотреть файл

@ -14,6 +14,7 @@
#include "include/constants.h"
#include "util/sys_info.h"
#include "util/os_path.h"
#include "util/os_create_dirpath.h"
#include "util/session_dir.h"
#include "util/proc_info.h"
#include "support.h"
@ -264,6 +265,8 @@ static bool test6(void)
static bool test7(void)
{
char *filenm;
FILE *fp;
/* create test proc session directory tree */
if (OMPI_ERROR == ompi_session_dir(true, NULL, ompi_system_info.user, "localhost", NULL, "test-universe", "test-job", "test-proc")) {
@ -275,6 +278,23 @@ static bool test7(void)
ompi_process_info.job_session_dir,
ompi_process_info.universe_session_dir);
/* create some files */
filenm = ompi_os_path(false, ompi_process_info.proc_session_dir, "dum1", NULL);
fp = fopen(filenm, "w");
fprintf(fp, "ss");
fclose(fp);
filenm = ompi_os_path(false, ompi_process_info.job_session_dir, "dum2", NULL);
fp = fopen(filenm, "w");
fprintf(fp, "ss");
fclose(fp);
filenm = ompi_os_path(false, ompi_process_info.universe_session_dir, "dum3", NULL);
fp = fopen(filenm, "w");
fprintf(fp, "ss");
fclose(fp);
if (OMPI_ERROR == ompi_session_dir_finalize()) {
return(false);
}