diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-04-03 00:40:57 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-04-03 00:40:57 +0000 |
commit | 3528f180d3ebcd8412d900eea8a18ca2e4f799aa (patch) | |
tree | f9f149ebd3cf5c19c823bad4f8982c075fc82fb4 /usr.bin | |
parent | ffdc4a6f4aac965d1582f47f75956962f0fc202f (diff) |
lint love; ok kjell
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mg/buffer.c | 8 | ||||
-rw-r--r-- | usr.bin/mg/file.c | 4 | ||||
-rw-r--r-- | usr.bin/mg/fileio.c | 13 | ||||
-rw-r--r-- | usr.bin/mg/tty.c | 4 | ||||
-rw-r--r-- | usr.bin/mg/ttyio.c | 6 |
5 files changed, 18 insertions, 17 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c index 0332f583045..5a2c4644d3e 100644 --- a/usr.bin/mg/buffer.c +++ b/usr.bin/mg/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.54 2005/12/20 06:17:35 kjell Exp $ */ +/* $OpenBSD: buffer.c,v 1.55 2006/04/03 00:40:56 deraadt Exp $ */ /* This file is in the public domain. */ @@ -47,7 +47,7 @@ usebuffer(int f, int n) bufp = eread("Switch to buffer: ", bufn, NBUFN, EFNEW | EFBUF); else bufp = eread("Switch to buffer: (default %s) ", bufn, NBUFN, - EFNUL | EFNEW | EFBUF, curbp->b_altb->b_bname); + EFNUL | EFNEW | EFBUF, curbp->b_altb->b_bname); if (bufp == NULL) return (ABORT); @@ -76,10 +76,10 @@ poptobuffer(int f, int n) if ((curbp->b_altb == NULL) && ((curbp->b_altb = bfind("*scratch*", TRUE)) == NULL)) bufp = eread("Switch to buffer in other window: ", bufn, NBUFN, - EFNEW | EFBUF); + EFNEW | EFBUF); else bufp = eread("Switch to buffer in other window: (default %s) ", - bufn, NBUFN, EFNUL | EFNEW | EFBUF, curbp->b_altb->b_bname); + bufn, NBUFN, EFNUL | EFNEW | EFBUF, curbp->b_altb->b_bname); if (bufp == NULL) return (ABORT); if (bufp[0] == '\0' && curbp->b_altb != NULL) diff --git a/usr.bin/mg/file.c b/usr.bin/mg/file.c index a6ed24c7aac..277d9140dff 100644 --- a/usr.bin/mg/file.c +++ b/usr.bin/mg/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.50 2005/12/20 06:17:36 kjell Exp $ */ +/* $OpenBSD: file.c,v 1.51 2006/04/03 00:40:56 deraadt Exp $ */ /* This file is in the public domain. */ @@ -381,7 +381,7 @@ doneread: newsize = linesize * 2; if (newsize < 0 || - (cp = malloc((unsigned)newsize)) == NULL) { + (cp = malloc(newsize)) == NULL) { ewprintf("Could not allocate %d bytes", newsize); s = FIOERR; diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c index 8b332174efd..4b607bc355d 100644 --- a/usr.bin/mg/fileio.c +++ b/usr.bin/mg/fileio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fileio.c,v 1.69 2006/04/02 20:21:19 kjell Exp $ */ +/* $OpenBSD: fileio.c,v 1.70 2006/04/03 00:40:56 deraadt Exp $ */ /* This file is in the public domain. */ @@ -204,7 +204,7 @@ fbackupfile(const char *fn) return (FALSE); } while ((nread = read(from, buf, sizeof(buf))) > 0) { - if (write(to, buf, nread) != nread) { + if (write(to, buf, (size_t)nread) != nread) { nread = -1; break; } @@ -351,10 +351,11 @@ nohome: int copy(char *frname, char *toname) { - int ifd, ofd, n; + int ifd, ofd; char buf[BUFSIZ]; mode_t fmode = DEFFILEMODE; /* XXX?? */ struct stat orig; + ssize_t sr; if ((ifd = open(frname, O_RDONLY)) == -1) return (FALSE); @@ -368,8 +369,8 @@ copy(char *frname, char *toname) close(ifd); return (FALSE); } - while ((n = read(ifd, buf, sizeof(buf))) > 0) { - if (write(ofd, buf, n) != n) { + while ((sr = read(ifd, buf, sizeof(buf))) > 0) { + if (write(ofd, buf, (size_t)sr) != sr) { ewprintf("write error : %s", strerror(errno)); break; } @@ -377,7 +378,7 @@ copy(char *frname, char *toname) if (fchmod(ofd, orig.st_mode) == -1) ewprintf("Cannot set original mode : %s", strerror(errno)); - if (n == -1) { + if (sr == -1) { ewprintf("Read error : %s", strerror(errno)); close(ifd); close(ofd); diff --git a/usr.bin/mg/tty.c b/usr.bin/mg/tty.c index 7ece27a42da..42bdb28d30b 100644 --- a/usr.bin/mg/tty.c +++ b/usr.bin/mg/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.26 2006/02/25 14:40:16 otto Exp $ */ +/* $OpenBSD: tty.c,v 1.27 2006/04/03 00:40:56 deraadt Exp $ */ /* This file is in the public domain. */ @@ -412,7 +412,7 @@ ttresize(void) #ifdef TIOCGWINSZ struct winsize winsize; - if (ioctl(0, TIOCGWINSZ, (char *) &winsize) == 0) { + if (ioctl(0, TIOCGWINSZ, &winsize) == 0) { newrow = winsize.ws_row; newcol = winsize.ws_col; } diff --git a/usr.bin/mg/ttyio.c b/usr.bin/mg/ttyio.c index 8828f446746..ae872d58de5 100644 --- a/usr.bin/mg/ttyio.c +++ b/usr.bin/mg/ttyio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ttyio.c,v 1.29 2005/12/13 06:01:27 kjell Exp $ */ +/* $OpenBSD: ttyio.c,v 1.30 2006/04/03 00:40:56 deraadt Exp $ */ /* This file is in the public domain. */ @@ -161,7 +161,7 @@ int ttgetc(void) { char c; - int ret; + ssize_t ret; do { ret = read(STDIN_FILENO, &c, 1); @@ -184,7 +184,7 @@ charswaiting(void) { int x; - return ((ioctl(0, FIONREAD, (char *) &x) < 0) ? 0 : x); + return ((ioctl(0, FIONREAD, &x) < 0) ? 0 : x); } /* |