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:
Landry Breuil
2014-12-03 17:26:42 +01:00
parent 03a86667d3
commit 97f974f7a8

View File

@@ -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';