Skip to content

Commit

Permalink
Fixes from official version.
Browse files Browse the repository at this point in the history
  • Loading branch information
kirgene committed Jul 30, 2015
1 parent 93d9fec commit cba28c6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ void become_daemon(void)
close(1);
close(2);

if (chdir("/")); // the 'if' is there to supress the unused-return-value-wanring
if (chdir("/"))
; // the 'if' is there to supress the unused-return-value-wanring
#endif
}

Expand Down Expand Up @@ -359,8 +360,10 @@ int read_data(int fd, unsigned char *buf, int len)
{
int nread=0;
int total_read = 0;

while (nread < len) {

if (fd<0) return -1;

while (total_read < len) {
nread = read(fd, buf+total_read, len-total_read);

if (nread < 0)
Expand Down

0 comments on commit cba28c6

Please sign in to comment.