Use a gint since fgetc returns an int. (#10417)
Should fix a warning on arm, and maybe other issues there..
This commit is contained in:
@@ -128,7 +128,7 @@ get_task_cmdline (Task *task)
|
|||||||
FILE *file;
|
FILE *file;
|
||||||
gchar filename[96];
|
gchar filename[96];
|
||||||
gint i;
|
gint i;
|
||||||
gchar c;
|
gint c;
|
||||||
|
|
||||||
snprintf (filename, 96, "/proc/%i/cmdline", task->pid);
|
snprintf (filename, 96, "/proc/%i/cmdline", task->pid);
|
||||||
if ((file = fopen (filename, "r")) == NULL)
|
if ((file = fopen (filename, "r")) == NULL)
|
||||||
@@ -136,7 +136,7 @@ get_task_cmdline (Task *task)
|
|||||||
|
|
||||||
/* Read full command byte per byte until EOF */
|
/* Read full command byte per byte until EOF */
|
||||||
for (i = 0; (c = fgetc (file)) != EOF && i < (gint)sizeof (task->cmdline) - 1; i++)
|
for (i = 0; (c = fgetc (file)) != EOF && i < (gint)sizeof (task->cmdline) - 1; i++)
|
||||||
task->cmdline[i] = (c == '\0') ? ' ' : c;
|
task->cmdline[i] = (c == '\0') ? ' ' : (gchar)c;
|
||||||
task->cmdline[i] = '\0';
|
task->cmdline[i] = '\0';
|
||||||
if (task->cmdline[i-1] == ' ')
|
if (task->cmdline[i-1] == ' ')
|
||||||
task->cmdline[i-1] = '\0';
|
task->cmdline[i-1] = '\0';
|
||||||
|
|||||||
Reference in New Issue
Block a user