diff --git a/free.c b/free.c index 3db0b59e..91fa4c71 100644 --- a/free.c +++ b/free.c @@ -202,7 +202,6 @@ static void check_unit_set(int *unit_set) int main(int argc, char **argv) { int c, flags = 0, unit_set = 0; - char *endptr; struct commandline_arguments args; /* diff --git a/proc/readproc.c b/proc/readproc.c index 48b56f67..0a30edee 100644 --- a/proc/readproc.c +++ b/proc/readproc.c @@ -624,11 +624,9 @@ LEAVE(0x160); ///////////////////////////////////////////////////////////////////////// static void statm2proc(const char* s, proc_t *restrict P) { - int num; - num = sscanf(s, "%ld %ld %ld %ld %ld %ld %ld", + sscanf(s, "%ld %ld %ld %ld %ld %ld %ld", &P->size, &P->resident, &P->share, &P->trs, &P->lrs, &P->drs, &P->dt); -/* fprintf(stderr, "statm2proc converted %d fields.\n",num); */ } static int file2str(const char *directory, const char *what, struct utlbuf_s *ub) { diff --git a/ps/output.c b/ps/output.c index 8c6a5289..f9a29bf6 100644 --- a/ps/output.c +++ b/ps/output.c @@ -1262,13 +1262,14 @@ static int pr_lxcname(char *restrict const outbuf, const proc_t *restrict const static int pr_context(char *restrict const outbuf, const proc_t *restrict const pp){ static void (*ps_freecon)(char*) = 0; static int (*ps_getpidcon)(pid_t pid, char **context) = 0; - static int (*ps_is_selinux_enabled)(void) = 0; - static int tried_load = 0; - static int selinux_enabled = 0; + static int selinux_enabled = 0;; size_t len; char *context; #if ENABLE_LIBSELINUX + static int (*ps_is_selinux_enabled)(void) = 0; + static int tried_load = 0; + if(!ps_getpidcon && !tried_load){ void *handle = dlopen("libselinux.so.1", RTLD_NOW); if(handle){ @@ -1792,7 +1793,7 @@ static const aix_struct aix_array[] = { {'z', "vsz", "VSZ"}, {'~', "~", "~"} /* NULL would ruin alphabetical order */ }; -static const int aix_array_count = sizeof(aix_array)/sizeof(aix_struct); +//static const int aix_array_count = sizeof(aix_array)/sizeof(aix_struct); /********************* sorting ***************************/ @@ -1826,7 +1827,7 @@ static const shortsort_struct shortsort_array[] = { {'y', "priority" }, /* nice */ {'~', "~" } /* NULL would ruin alphabetical order */ }; -static const int shortsort_array_count = sizeof(shortsort_array)/sizeof(shortsort_struct); +//static const int shortsort_array_count = sizeof(shortsort_array)/sizeof(shortsort_struct); /*********** print format_array **********/ diff --git a/ps/parser.c b/ps/parser.c index 8d533b38..4287d074 100644 --- a/ps/parser.c +++ b/ps/parser.c @@ -1096,7 +1096,7 @@ static int arg_type(const char *str){ if((tmp>='a') && (tmp<='z')) return ARG_GNU; if((tmp>='A') && (tmp<='Z')) return ARG_GNU; if(tmp=='\0') return ARG_END; - return ARG_FAIL; + return ARG_FAIL; } /* First assume sysv, because that is the POSIX and Unix98 standard. */ diff --git a/ps/sortformat.c b/ps/sortformat.c index 5ffc25b2..ace5fa70 100644 --- a/ps/sortformat.c +++ b/ps/sortformat.c @@ -238,7 +238,7 @@ static const char *format_parse(sf_node *sfn){ need_item=0; } } while (*++walk); -out: + if(!items){ free(buf); goto empty; diff --git a/ps/stacktrace.c b/ps/stacktrace.c index a0b4755c..01ea217d 100644 --- a/ps/stacktrace.c +++ b/ps/stacktrace.c @@ -173,10 +173,12 @@ void debug(int method, char *prog_name){ } /************/ +#if 0 static void stack_trace_sigsegv(int signum){ (void)signum; debug(STACK_TRACE, stored_prog_name); } +#endif /************/ #ifdef DEBUG diff --git a/watch.c b/watch.c index 215b4bf5..e8bfb75f 100644 --- a/watch.c +++ b/watch.c @@ -234,8 +234,8 @@ static void process_ansi(FILE * fp) if (buf[0] == '\0') set_ansi_attribute(0); - for (endptr = numstart = buf; *endptr != '\0'; numstart = endptr + 1) { - if (!set_ansi_attribute(strtol(numstart, &endptr, 10))) + for (endptr = numstart = buf; *endptr != '\0'; numstart = endptr + 1) { + if (!set_ansi_attribute(strtol(numstart, &endptr, 10))) break; } }