1
From 57e7400d046f382ee94745791ccb0e1a06efb2e4 Mon Sep 17 00:00:00 2001
2
From: Adam Sampson <ats@offog.org>
3
Date: Wed, 1 Apr 2015 20:33:41 +0100
4
Subject: [PATCH 3/3] The result of fgetc is an int, not a char
6
Without this change, get_pid_environ_val would go into an infinite loop
7
when asked to find a variable that doesn't exist on a platform where
8
char is unsigned (e.g. ARM): fgetc would return -1 (EOF), which would be
9
stored as 255 in temp[i], which then wouldn't be equal to -1 when
12
das_watchdog.c | 11 ++++++-----
13
1 file changed, 6 insertions(+), 5 deletions(-)
15
diff --git a/das_watchdog.c b/das_watchdog.c
16
index 176fb1b..0dfe38a 100644
19
@@ -322,21 +322,20 @@ static char *get_pid_environ_val(pid_t pid,char *val){
28
temp = realloc(temp, temp_size);
33
- if(foundit==1 && (temp[i]=='\0' || temp[i]==EOF)){
34
+ if(foundit==1 && (c=='\0' || c==EOF)){
45
@@ -349,9 +348,11 @@ static char *get_pid_environ_val(pid_t pid,char *val){