diff --git a/src/client/client/intercept_exec.c b/src/client/client/intercept_exec.c index 14b555ed..2cfd6d8f 100644 --- a/src/client/client/intercept_exec.c +++ b/src/client/client/intercept_exec.c @@ -71,7 +71,7 @@ static int shouldPropogateSpindle(char **envp, const char *fname) } spindle = orig_getenv ? orig_getenv("SPINDLE") : getenv("SPINDLE"); - if (spindle && (strcasecmp(spindle, "false") == 0 || strcmp("spindle", "0") == 0)) { + if (spindle && (strcasecmp(spindle, "false") == 0 || strcmp(spindle, "0") == 0)) { debug_printf2("Not propogating spindle through exec because getenv(\"SPINDLE\") = %s\n", spindle); return 0; } diff --git a/src/client/client/lookup.c b/src/client/client/lookup.c index a2e8c9d1..1be836fa 100644 --- a/src/client/client/lookup.c +++ b/src/client/client/lookup.c @@ -213,7 +213,7 @@ int get_existance_test(int fd, const char *path, int *exists) found_file = check_cache(path, "&", cache_name, dir_name, ENOENT, &errcode, &exist_str); if (found_file) { *exists = (exist_str && *exist_str == 'y'); - spindle_free(exist_str); + spindle_free(exist_str); // malloc'd in check_cache return 0; } } @@ -226,7 +226,6 @@ int get_existance_test(int fd, const char *path, int *exists) if (use_cache) { exist_str = *exists ? "y" : "n"; update_cache(cache_name, dir_name, exist_str, &errcode, ENOENT); - spindle_free(exist_str); } return result; diff --git a/src/client/shm_cache/shmcache.c b/src/client/shm_cache/shmcache.c index 75640fbc..59d04d31 100644 --- a/src/client/shm_cache/shmcache.c +++ b/src/client/shm_cache/shmcache.c @@ -380,6 +380,7 @@ static int shmcache_add_worker(const char *libname, const char *mapped_name, int if (!mappedname_str) { free_sheep_entry(entry); free_sheep_str(libname_str); + return -1; } strncpy(mappedname_str, mapped_name, mappedname_len); } diff --git a/src/fe/startup/jobtask.h b/src/fe/startup/jobtask.h index 273987c9..4d20668a 100644 --- a/src/fe/startup/jobtask.h +++ b/src/fe/startup/jobtask.h @@ -48,7 +48,7 @@ class JobTask } ~JobTask() { - if (app_argc & !noclean) { + if (app_argc && !noclean) { for (int i = 0; i < app_argc; i++) free(app_argv[i]); free(app_argv); diff --git a/src/flux/flux-spindle.c b/src/flux/flux-spindle.c index 6c99341a..bd2213f2 100644 --- a/src/flux/flux-spindle.c +++ b/src/flux/flux-spindle.c @@ -362,7 +362,7 @@ static int parse_yesno(opt_t *opt, opt_t flag, const char *yesno) if (strcasecmp(yesno, "no") == 0 || strcasecmp(yesno, "false") == 0 || strcasecmp(yesno, "0") == 0) *opt &= ~flag; else if (strcasecmp(yesno, "yes") == 0 || strcasecmp(yesno, "true") == 0 || strcasecmp(yesno, "1") == 0) - *opt |= 1; + *opt |= flag; else logerrno_printf_and_return(1, "Error in spindle option: Expected 'yes' or 'no', got %s\n", yesno); return 0; diff --git a/src/flux/procmgr.c b/src/flux/procmgr.c index 9dcdd448..33fbdbf5 100644 --- a/src/flux/procmgr.c +++ b/src/flux/procmgr.c @@ -96,7 +96,7 @@ int init_readymsg() int result, error; result = pipe(ready_pipe); if (result == -1) { - error = result; + error = errno; fprintf(stderr, "Could not create ready pipe for spindle session: %s\n", strerror(error)); return -1; } @@ -216,7 +216,7 @@ static int read_pidfile(const char *name, const char *session_dir) snprintf(session_path, sizeof(session_path), "%s/%s.pid", session_dir, name); session_path[sizeof(session_path)-1] = '\0'; - f = fopen(session_path, "w"); + f = fopen(session_path, "r"); if (!f) { error = errno; fprintf(stderr, "Error reading pid file for spindle service at %s: %s\n", session_path, strerror(error)); diff --git a/src/server/auditserver/msgbundle.c b/src/server/auditserver/msgbundle.c index d1ff8906..1324428f 100644 --- a/src/server/auditserver/msgbundle.c +++ b/src/server/auditserver/msgbundle.c @@ -135,7 +135,7 @@ static void *thrd_main(void *timeout) do { debug_printf2("Triggering message buffer cache flush due to timeout\n"); result = write(flush_pipe[1], "f", 1); - } while (result == EINTR); + } while (result == -1 && errno == EINTR); pthread_mutex_lock(&mut); active_timeout = 0; diff --git a/src/server/auditserver/translate_maps.c b/src/server/auditserver/translate_maps.c index e3155df9..8a05f062 100644 --- a/src/server/auditserver/translate_maps.c +++ b/src/server/auditserver/translate_maps.c @@ -49,7 +49,6 @@ static int open_replacement_proc_maps(char *spindle_dir, int pid, char *output_f static int uniqnum = 0; snprintf(output_file, output_file_size, "%s/spindle_proc_maps_%d_%d", spindle_dir, pid, uniqnum++); - output_file[MAX_NAME_LEN] = '\0'; fd = open(output_file, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); if (fd == -1) { error = errno; @@ -160,7 +159,7 @@ static int translate_line(char *spindle_dir, char *line, int *linelen, int maxle lastpart = spindle_dir; if (*(lastpart+1) == '\0') { lastpart--; - while (lastpart != line && *lastpart != '/') lastpart--; + while (lastpart != spindle_dir && *lastpart != '/') lastpart--; } p = strstr(line, lastpart); @@ -199,7 +198,7 @@ int translate_proc_pid_maps(char *spindle_dir, int pid, char *output_file, int o } newfd = open_replacement_proc_maps(spindle_dir, pid, output_file, output_file_size); - if (fd == -1) { + if (newfd == -1) { close(fd); return -1; } diff --git a/src/utils/exitnote.c b/src/utils/exitnote.c index d071efc3..69e7ac17 100644 --- a/src/utils/exitnote.c +++ b/src/utils/exitnote.c @@ -181,7 +181,7 @@ int pingExitNote(const char *location) done: if (socketpath) free(socketpath); - if (sockfd) + if (sockfd != -1) close(sockfd); return presult; diff --git a/src/utils/handle_vararg.h b/src/utils/handle_vararg.h index 8673b091..95c9f295 100644 --- a/src/utils/handle_vararg.h +++ b/src/utils/handle_vararg.h @@ -44,6 +44,7 @@ errno = ENOMEM; \ return -1; \ } \ + argv = newp; \ } \ } \ \