Coverity CID 1194: Negative returns (from Arnaud Lacombe)
This commit is contained in:
parent
ebd0b89ad0
commit
b7ae68fde0
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fifo.c,v 1.2 2002/10/29 10:39:36 martin Exp $ */
|
||||
/* $NetBSD: fifo.c,v 1.3 2006/09/29 14:18:25 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -115,6 +115,11 @@ main(int argc, char **argv)
|
||||
printf("fifo: incorrect filter, expecting EVFILT_READ\n");
|
||||
|
||||
n = read(fd, buffer, event[0].data);
|
||||
if (n < 0) {
|
||||
warn("read");
|
||||
error = 1;
|
||||
goto out;
|
||||
}
|
||||
buffer[n] = '\0';
|
||||
printf("fifo: read '%s'\n", buffer);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: file.c,v 1.3 2002/12/06 02:06:16 thorpej Exp $ */
|
||||
/* $NetBSD: file.c,v 1.4 2006/09/29 14:18:25 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -104,6 +104,8 @@ main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
n = read(fd, buffer, 128);
|
||||
if (n < 0)
|
||||
err(1, "read");
|
||||
buffer[n] = '\0';
|
||||
printf("file(%d): %s", num, buffer);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pipe1.c,v 1.1.1.1 2002/10/03 07:46:03 jdolecek Exp $ */
|
||||
/* $NetBSD: pipe1.c,v 1.2 2006/09/29 14:18:25 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -82,6 +82,8 @@ main(int argc, char **argv)
|
||||
n, event[0].flags, event[0].fflags, event[0].data);
|
||||
|
||||
n = read(fds[0], buffer, event[0].data);
|
||||
if (n < 0)
|
||||
err(1, "read");
|
||||
buffer[n] = '\0';
|
||||
printf("pipe: read '%s'\n", buffer);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vnode.c,v 1.2 2003/10/21 09:42:48 itojun Exp $ */
|
||||
/* $NetBSD: vnode.c,v 1.3 2006/09/29 14:18:25 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -139,6 +139,8 @@ main(int argc, char **argv)
|
||||
if (event[0].data < 0)
|
||||
lseek(fd, 0, SEEK_END);
|
||||
n = read(fd, buffer, 128);
|
||||
if (n < 0)
|
||||
err(1, "read");
|
||||
buffer[n] = '\0';
|
||||
printf("[%d] %s", n, buffer);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: inet.c,v 1.6 2006/05/10 19:10:09 mrg Exp $ */
|
||||
/* $NetBSD: inet.c,v 1.7 2006/09/29 14:18:25 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -273,6 +273,8 @@ printf("ir: match is %d\n", match); /* sleep(1); */
|
||||
continue;
|
||||
|
||||
n = read(fd, buffer, 128);
|
||||
if (n < 0)
|
||||
err(1, "read");
|
||||
buffer[n] = '\0';
|
||||
buffer[0] = '\0';
|
||||
printf("[%d] %s", n, buffer);
|
||||
|
Loading…
Reference in New Issue
Block a user