summaryrefslogtreecommitdiffstats
path: root/bin/cat
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2002-02-22 20:51:00 +0000
committermarkm <markm@FreeBSD.org>2002-02-22 20:51:00 +0000
commit7b7558d88436331476243b0b668d2e257d7687fe (patch)
treeba3cea9a04974b56b589e2a934d2f4ae56780dce /bin/cat
parentf24931e332589b25b779130a37d5f3491e609025 (diff)
downloadFreeBSD-src-7b7558d88436331476243b0b668d2e257d7687fe.zip
FreeBSD-src-7b7558d88436331476243b0b668d2e257d7687fe.tar.gz
Fix warnings inspired by lint, a commercial lint and WARNS=4.
Diffstat (limited to 'bin/cat')
-rw-r--r--bin/cat/cat.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/bin/cat/cat.c b/bin/cat/cat.c
index b167fa2..c56abfb 100644
--- a/bin/cat/cat.c
+++ b/bin/cat/cat.c
@@ -109,7 +109,7 @@ main(int argc, char *argv[])
vflag = 1;
break;
default:
- (void)fprintf(stderr,
+ fprintf(stderr,
"usage: cat [-benstuv] [-] [file ...]\n");
exit(1);
}
@@ -187,12 +187,12 @@ cook_cat(FILE *fp)
continue;
}
if (nflag && !bflag) {
- (void)fprintf(stdout, "%6d\t", ++line);
+ fprintf(stdout, "%6d\t", ++line);
if (ferror(stdout))
break;
}
} else if (nflag) {
- (void)fprintf(stdout, "%6d\t", ++line);
+ fprintf(stdout, "%6d\t", ++line);
if (ferror(stdout))
break;
}
@@ -240,7 +240,7 @@ raw_cat(int rfd)
int off, wfd;
ssize_t nr, nw;
static size_t bsize;
- static char *buf;
+ static char *buf = NULL;
struct stat sbuf;
wfd = fileno(stdout);
@@ -268,14 +268,15 @@ udom_open(const char *path, int flags)
{
struct sockaddr_un sou;
int fd;
- int len;
+ unsigned int len;
bzero(&sou, sizeof(sou));
/*
* Construct the unix domain socket address and attempt to connect
*/
- if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0) {
+ fd = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (fd >= 0) {
sou.sun_family = AF_UNIX;
snprintf(sou.sun_path, sizeof(sou.sun_path), "%s", path);
len = strlen(sou.sun_path);
@@ -293,10 +294,12 @@ udom_open(const char *path, int flags)
if (fd >= 0) {
switch(flags & O_ACCMODE) {
case O_RDONLY:
- shutdown(fd, SHUT_WR);
+ if (shutdown(fd, SHUT_WR) == -1)
+ perror("cat");
break;
case O_WRONLY:
- shutdown(fd, SHUT_RD);
+ if (shutdown(fd, SHUT_RD) == -1)
+ perror("cat");
break;
default:
break;
@@ -306,4 +309,3 @@ udom_open(const char *path, int flags)
}
#endif
-
OpenPOWER on IntegriCloud