[memprof: 14/76] process.c: Make gcc happy about the getline usage.
- From: Holger Hans Peter Freyther <hfreyther src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [memprof: 14/76] process.c: Make gcc happy about the getline usage.
- Date: Sun, 13 Jun 2010 03:39:24 +0000 (UTC)
commit 3a3148d3e0c2585d5a4d62d724f1bd654f2a2f9b
Author: Holger Hans Peter Freyther <zecke selfish org>
Date: Thu Jun 4 13:06:25 2009 +0200
process.c: Make gcc happy about the getline usage.
src/process.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/process.c b/src/process.c
index 5d67a51..6d232fd 100644
--- a/src/process.c
+++ b/src/process.c
@@ -860,7 +860,7 @@ process_get_cmdline (MPProcess *process)
char *fname;
char *result;
char *tmp = NULL;
- int n = 0;
+ size_t n = 0;
FILE *in = NULL;
if (process->status == MP_PROCESS_DEFUNCT)
@@ -874,9 +874,12 @@ process_get_cmdline (MPProcess *process)
}
g_free (fname);
- getline (&tmp, &n, in);
- result = g_strdup (tmp);
- free (tmp);
+ if (getline (&tmp, &n, in) == -1)
+ result = g_strdup ("");
+ else {
+ result = g_strdup (tmp);
+ free (tmp);
+ }
fclose (in);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]