compiler warning and possible misbahavior in iocLogServer.c
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
EPICS Base |
Invalid
|
Undecided
|
Unassigned |
Bug Description
../iocLogServer.c: In function 'seekLatestLine':
../iocLogServer
../iocLogServer
This is the code:
char c = fgetc (pserver-
/*
* bypass the line if it does not match the expected format
*/
while ( c!=EOF && c!='\n' ) {
c = fgetc (pserver-
}
if (c==EOF) {
}
The problem is that EOF is -1 but char is unsigned on some systems. Where char is signed, it is worse because here the code 0xFF is treated as EOF.
The solution is to use 'int c', as described in the man page of fgetc.
Thi s was fixed in commit 12370 to the 3.14 branch in October 2012, and thus was present in the 3.14.12.3 release from almost a year ago.