diff --git a/proc/diskstat.c b/proc/diskstat.c index 1a7d50c1..2b8409b0 100644 --- a/proc/diskstat.c +++ b/proc/diskstat.c @@ -183,7 +183,7 @@ PROCPS_EXPORT int procps_diskstat_new ( PROCPS_EXPORT int procps_diskstat_read ( struct procps_diskstat *info) { - int retval, is_disk; + int retval; char buf[DISKSTAT_LINE_LEN]; char devname[DISKSTAT_NAME_LEN]; struct procps_diskstat_dev *disk; diff --git a/proc/namespace.c b/proc/namespace.c index d61b1b6f..cd4f47d5 100644 --- a/proc/namespace.c +++ b/proc/namespace.c @@ -107,4 +107,5 @@ PROCPS_EXPORT int procps_ns_read_pid( else nsp->ns[i] = 0; } + return 0; } diff --git a/proc/readproc.c b/proc/readproc.c index 9036f11c..0d2eb7cb 100644 --- a/proc/readproc.c +++ b/proc/readproc.c @@ -1128,7 +1128,7 @@ static int simple_nextpid(PROCTAB *restrict const PT, proc_t *restrict const p) char *restrict const path = PT->path; for (;;) { ent = readdir(PT->procfs); - if(unlikely(unlikely(!ent) || unlikely(!ent->d_name))) return 0; + if(unlikely(unlikely(!ent) || unlikely(!ent->d_name[0]))) return 0; if(likely(likely(*ent->d_name > '0') && likely(*ent->d_name <= '9'))) break; } p->tgid = strtoul(ent->d_name, NULL, 10); @@ -1155,7 +1155,7 @@ static int simple_nexttid(PROCTAB *restrict const PT, const proc_t *restrict con } for (;;) { ent = readdir(PT->taskdir); - if(unlikely(unlikely(!ent) || unlikely(!ent->d_name))) return 0; + if(unlikely(unlikely(!ent) || unlikely(!ent->d_name[0]))) return 0; if(likely(likely(*ent->d_name > '0') && likely(*ent->d_name <= '9'))) break; } t->tid = strtoul(ent->d_name, NULL, 10); diff --git a/proc/sysinfo.c b/proc/sysinfo.c index c9dc9f3c..f58d139c 100644 --- a/proc/sysinfo.c +++ b/proc/sysinfo.c @@ -41,16 +41,8 @@ " proc /proc proc defaults\n" \ " In the meantime, run \"mount proc /proc -t proc\"\n" -#define STAT_FILE "/proc/stat" -static int stat_fd = -1; #define LOADAVG_FILE "/proc/loadavg" static int loadavg_fd = -1; -#define MEMINFO_FILE "/proc/meminfo" -static int meminfo_fd = -1; -#define VMINFO_FILE "/proc/vmstat" -static int vminfo_fd = -1; -#define VM_MIN_FREE_FILE "/proc/sys/vm/min_free_kbytes" -static int vm_min_free_fd = -1; // As of 2.6.24 /proc/meminfo seems to need 888 on 64-bit, // and would need 1258 if the obsolete fields were there. diff --git a/proc/uptime.c b/proc/uptime.c index e6412052..c692fd0e 100644 --- a/proc/uptime.c +++ b/proc/uptime.c @@ -154,8 +154,6 @@ PROCPS_EXPORT char *procps_uptime_sprint_short(void) int updecades, upyears, upweeks, updays, uphours, upminutes; int pos = 3; int comma = 0; - time_t realseconds; - struct tm *realtime; double uptime_secs, idle_secs; shortbuf[0] = '\0'; diff --git a/vmstat.c b/vmstat.c index 81579449..f53eaac9 100644 --- a/vmstat.c +++ b/vmstat.c @@ -542,7 +542,7 @@ static void diskformat(void) struct tm *tm_ptr; char timebuf[32]; const char format[] = "%-5s %6lu %6lu %7lu %7lu %6lu %6lu %7lu %7lu %6lu %6lu"; - const char wide_format[] = "%-5s %9lu %9lu %lu %1u %9lu %9lu %lu %1u %7lu %7lu"; + const char wide_format[] = "%-5s %9lu %9lu %lu %lu %9lu %9lu %lu %lu %7lu %7lu"; if (procps_diskstat_new(&disk_stat) < 0) xerr(EXIT_FAILURE, diff --git a/watch.c b/watch.c index 40beacad..b7dd4412 100644 --- a/watch.c +++ b/watch.c @@ -198,7 +198,7 @@ static void process_ansi(FILE * fp) { int i, c; char buf[MAX_ANSIBUF]; - char *numstart, *endptr; + char *numstart, *endptr = buf; c = getc(fp); if (c != '[') {