fix warnings
This commit is contained in:
parent
7ac9a0e1f5
commit
029864fe4f
@ -77,7 +77,7 @@ void freeproc(proc_t* p) {
|
|||||||
|
|
||||||
static void status2proc(const char *S, proc_t *restrict P){
|
static void status2proc(const char *S, proc_t *restrict P){
|
||||||
char* tmp;
|
char* tmp;
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
// The cmd is escaped, with \\ and \n for backslash and newline.
|
// The cmd is escaped, with \\ and \n for backslash and newline.
|
||||||
// It certainly may contain "VmSize:" and similar crap.
|
// It certainly may contain "VmSize:" and similar crap.
|
||||||
@ -169,7 +169,7 @@ static void status2proc(const char *S, proc_t *restrict P){
|
|||||||
* is used instead. (except for embedded ')' "(%[^)]c)" would work.
|
* is used instead. (except for embedded ')' "(%[^)]c)" would work.
|
||||||
*/
|
*/
|
||||||
static void stat2proc(const char* S, proc_t *restrict P) {
|
static void stat2proc(const char* S, proc_t *restrict P) {
|
||||||
int num;
|
unsigned num;
|
||||||
char* tmp;
|
char* tmp;
|
||||||
|
|
||||||
/* fill in default values for older kernels */
|
/* fill in default values for older kernels */
|
||||||
@ -300,11 +300,11 @@ static char** file2strvec(const char* directory, const char* what) {
|
|||||||
int read_cmdline(char *restrict const dst, unsigned sz, unsigned pid){
|
int read_cmdline(char *restrict const dst, unsigned sz, unsigned pid){
|
||||||
char name[32];
|
char name[32];
|
||||||
int fd;
|
int fd;
|
||||||
int n = 0;
|
unsigned n = 0;
|
||||||
|
dst[0] = '\0';
|
||||||
snprintf(name, sizeof name, "/proc/%u/cmdline", pid);
|
snprintf(name, sizeof name, "/proc/%u/cmdline", pid);
|
||||||
fd = open(name, O_RDONLY);
|
fd = open(name, O_RDONLY);
|
||||||
if(fd==-1) return NULL;
|
if(fd==-1) return 0;
|
||||||
dst[0] = '\0';
|
|
||||||
for(;;){
|
for(;;){
|
||||||
ssize_t r = read(fd,dst+n,sz-n);
|
ssize_t r = read(fd,dst+n,sz-n);
|
||||||
if(r==-1){
|
if(r==-1){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user