[memprof: 14/76] process.c: Make gcc happy about the getline usage.



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]