misc: eliminate a couple of miscellaneous gcc warnings
This commit just addresses those warnings shown below.
Reference(s):
proc/sysinfo.c: In function `getrunners':
proc/sysinfo.c:491:26: warning: `%s' directive writing up to 255 bytes into a region of size 26 [-Wformat-overflow=]
491 | sprintf(tbuf, "/proc/%s/stat", ent->d_name);
| ^~
pgrep.c: In function `select_procs':
pgrep.c:591:11: warning: suggest explicit braces to avoid ambiguous `else' [-Wdangling-else]
591 | else if (opt_older)
| ^
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
@@ -488,7 +488,7 @@ static void getrunners(unsigned int *restrict running, unsigned int *restrict bl
|
||||
char c;
|
||||
|
||||
if (!isdigit(ent->d_name[0])) continue;
|
||||
sprintf(tbuf, "/proc/%s/stat", ent->d_name);
|
||||
snprintf(tbuf, sizeof(tbuf), "/proc/%s/stat", ent->d_name);
|
||||
|
||||
fd = open(tbuf, O_RDONLY, 0);
|
||||
if (fd == -1) continue;
|
||||
|
||||
Reference in New Issue
Block a user