When utility buffers were introduced for file2str read
requests, a subtle change was inadvertently introduced
such that a read of zero no longer returns a -1 value.
This commit ensures that zero bytes read returns a -1.
And although the solution differs from a merge request
submitted by sergey.senozhatsky@gmail.com, a thank you
is offered for revealing this potential abend problem.
References(s):
commit
a45dace4b82c9cdcda7020ca5665153b1e81275f
http://gitorious.org/procps/procps/merge_requests/11
Signed-off-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Craig Small <csmall@enc.com.au>
};
ub->buf[tot_read] = '\0';
close(fd);
+ if (unlikely(tot_read < 1)) return -1;
return tot_read;
#undef readMAX
#undef buffMIN