diff options
author | 2006-04-02 00:48:33 +0000 | |
---|---|---|
committer | 2006-04-02 00:48:33 +0000 | |
commit | 85c482d69067218833925405774a91c4580a968d (patch) | |
tree | 62589bef44ecebd12692819da6ac7d90c41f7933 | |
parent | sprinkle a socklen_t (diff) | |
download | wireguard-openbsd-85c482d69067218833925405774a91c4580a968d.tar.xz wireguard-openbsd-85c482d69067218833925405774a91c4580a968d.zip |
use SEEK_* for lseek()
-rw-r--r-- | bin/ksh/shf.c | 4 | ||||
-rw-r--r-- | libexec/uucpd/uucpd.c | 6 | ||||
-rw-r--r-- | sbin/dump/traverse.c | 8 | ||||
-rw-r--r-- | sbin/fsck_ext2fs/utilities.c | 14 | ||||
-rw-r--r-- | sbin/fsck_ffs/utilities.c | 16 | ||||
-rw-r--r-- | sbin/growfs/growfs.c | 6 | ||||
-rw-r--r-- | sbin/modload/a.out.c | 4 | ||||
-rw-r--r-- | sbin/ncheck_ffs/ncheck_ffs.c | 8 | ||||
-rw-r--r-- | sbin/pdisk/file_media.c | 8 | ||||
-rw-r--r-- | usr.bin/less/ch.c | 6 | ||||
-rw-r--r-- | usr.bin/less/decode.c | 2 | ||||
-rw-r--r-- | usr.bin/less/edit.c | 2 | ||||
-rw-r--r-- | usr.bin/less/filename.c | 4 | ||||
-rw-r--r-- | usr.bin/mail/fio.c | 6 | ||||
-rw-r--r-- | usr.sbin/edquota/edquota.c | 4 | ||||
-rw-r--r-- | usr.sbin/fdformat/fdformat.c | 4 | ||||
-rw-r--r-- | usr.sbin/quot/quot.c | 8 | ||||
-rw-r--r-- | usr.sbin/rarpd/rarpd.c | 6 |
18 files changed, 58 insertions, 58 deletions
diff --git a/bin/ksh/shf.c b/bin/ksh/shf.c index 31bd0f39a86..1352a2f22aa 100644 --- a/bin/ksh/shf.c +++ b/bin/ksh/shf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: shf.c,v 1.14 2005/12/11 18:53:51 deraadt Exp $ */ +/* $OpenBSD: shf.c,v 1.15 2006/04/02 00:48:33 deraadt Exp $ */ /* * Shell file I/O routines @@ -285,7 +285,7 @@ shf_flush(struct shf *shf) if (shf->flags & SHF_READING) { shf->flags &= ~(SHF_EOF | SHF_READING); if (shf->rnleft > 0) { - lseek(shf->fd, (off_t) -shf->rnleft, 1); + lseek(shf->fd, (off_t) -shf->rnleft, SEEK_CUR); shf->rnleft = 0; shf->rp = shf->buf; } diff --git a/libexec/uucpd/uucpd.c b/libexec/uucpd/uucpd.c index c9400fad567..54bfc33e4ba 100644 --- a/libexec/uucpd/uucpd.c +++ b/libexec/uucpd/uucpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uucpd.c,v 1.30 2005/04/13 02:33:09 deraadt Exp $ */ +/* $OpenBSD: uucpd.c,v 1.31 2006/04/02 00:48:55 deraadt Exp $ */ /* * Copyright (c) 1985 The Regents of the University of California. @@ -40,7 +40,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)uucpd.c 5.10 (Berkeley) 2/26/91";*/ -static char rcsid[] = "$OpenBSD: uucpd.c,v 1.30 2005/04/13 02:33:09 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: uucpd.c,v 1.31 2006/04/02 00:48:55 deraadt Exp $"; #endif /* not lint */ /* @@ -298,7 +298,7 @@ dologin(struct passwd *pw, struct sockaddr *sa) struct lastlog ll; time(&ll.ll_time); - lseek(f, pw->pw_uid * sizeof(struct lastlog), 0); + lseek(f, pw->pw_uid * sizeof(struct lastlog), SEEK_SET); SCPYN(ll.ll_line, hbuf); SCPYN(ll.ll_host, hbuf); (void) write(f, (char *) &ll, sizeof ll); diff --git a/sbin/dump/traverse.c b/sbin/dump/traverse.c index 8dcad224be7..6abec7820ef 100644 --- a/sbin/dump/traverse.c +++ b/sbin/dump/traverse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: traverse.c,v 1.15 2003/08/25 23:28:15 tedu Exp $ */ +/* $OpenBSD: traverse.c,v 1.16 2006/04/02 00:48:35 deraadt Exp $ */ /* $NetBSD: traverse.c,v 1.17 1997/06/05 11:13:27 lukem Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)traverse.c 8.2 (Berkeley) 9/23/93"; #else -static const char rcsid[] = "$OpenBSD: traverse.c,v 1.15 2003/08/25 23:28:15 tedu Exp $"; +static const char rcsid[] = "$OpenBSD: traverse.c,v 1.16 2006/04/02 00:48:35 deraadt Exp $"; #endif #endif /* not lint */ @@ -606,7 +606,7 @@ bread(daddr_t blkno, char *buf, int size) int cnt, i; loop: - if (lseek(diskfd, ((off_t)blkno << dev_bshift), 0) < 0) + if (lseek(diskfd, ((off_t)blkno << dev_bshift), SEEK_SET) < 0) msg("bread: lseek fails\n"); if ((cnt = read(diskfd, buf, size)) == size) return; @@ -646,7 +646,7 @@ loop: */ memset(buf, 0, size); for (i = 0; i < size; i += dev_bsize, buf += dev_bsize, blkno++) { - if (lseek(diskfd, ((off_t)blkno << dev_bshift), 0) < 0) + if (lseek(diskfd, ((off_t)blkno << dev_bshift), SEEK_SET) < 0) msg("bread: lseek2 fails!\n"); if ((cnt = read(diskfd, buf, (int)dev_bsize)) == dev_bsize) continue; diff --git a/sbin/fsck_ext2fs/utilities.c b/sbin/fsck_ext2fs/utilities.c index 402d37b74c7..1cbc517a4c8 100644 --- a/sbin/fsck_ext2fs/utilities.c +++ b/sbin/fsck_ext2fs/utilities.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utilities.c,v 1.15 2006/03/30 01:16:30 deraadt Exp $ */ +/* $OpenBSD: utilities.c,v 1.16 2006/04/02 00:48:35 deraadt Exp $ */ /* $NetBSD: utilities.c,v 1.6 2001/02/04 21:19:34 christos Exp $ */ /* @@ -285,19 +285,19 @@ bread(int fd, char *buf, daddr_t blk, long size) offset = blk; offset *= dev_bsize; - if (lseek(fd, offset, 0) < 0) + if (lseek(fd, offset, SEEK_SET) < 0) rwerror("SEEK", blk); else if (read(fd, buf, (int)size) == size) return (0); rwerror("READ", blk); - if (lseek(fd, offset, 0) < 0) + if (lseek(fd, offset, SEEK_SET) < 0) rwerror("SEEK", blk); errs = 0; memset(buf, 0, (size_t)size); printf("THE FOLLOWING DISK SECTORS COULD NOT BE READ:"); for (cp = buf, i = 0; i < size; i += secsize, cp += secsize) { if (read(fd, cp, (int)secsize) != secsize) { - (void)lseek(fd, offset + i + secsize, 0); + (void)lseek(fd, offset + i + secsize, SEEK_SET); if (secsize != dev_bsize && dev_bsize != 1) printf(" %ld (%ld),", (blk * dev_bsize + i) / secsize, @@ -322,19 +322,19 @@ bwrite(int fd, char *buf, daddr_t blk, long size) return; offset = blk; offset *= dev_bsize; - if (lseek(fd, offset, 0) < 0) + if (lseek(fd, offset, SEEK_SET) < 0) rwerror("SEEK", blk); else if (write(fd, buf, (int)size) == size) { fsmodified = 1; return; } rwerror("WRITE", blk); - if (lseek(fd, offset, 0) < 0) + if (lseek(fd, offset, SEEK_SET) < 0) rwerror("SEEK", blk); printf("THE FOLLOWING SECTORS COULD NOT BE WRITTEN:"); for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize) if (write(fd, cp, (int)dev_bsize) != dev_bsize) { - (void)lseek(fd, offset + i + dev_bsize, 0); + (void)lseek(fd, offset + i + dev_bsize, SEEK_SET); printf(" %ld,", blk + i / dev_bsize); } printf("\n"); diff --git a/sbin/fsck_ffs/utilities.c b/sbin/fsck_ffs/utilities.c index 65e20ee6295..168cb8dab47 100644 --- a/sbin/fsck_ffs/utilities.c +++ b/sbin/fsck_ffs/utilities.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utilities.c,v 1.25 2006/03/30 01:16:31 deraadt Exp $ */ +/* $OpenBSD: utilities.c,v 1.26 2006/04/02 00:48:35 deraadt Exp $ */ /* $NetBSD: utilities.c,v 1.18 1996/09/27 22:45:20 christos Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)utilities.c 8.1 (Berkeley) 6/5/93"; #else -static const char rcsid[] = "$OpenBSD: utilities.c,v 1.25 2006/03/30 01:16:31 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: utilities.c,v 1.26 2006/04/02 00:48:35 deraadt Exp $"; #endif #endif /* not lint */ @@ -305,19 +305,19 @@ bread(int fd, char *buf, daddr_t blk, long size) offset = blk; offset *= dev_bsize; - if (lseek(fd, offset, 0) < 0) + if (lseek(fd, offset, SEEK_SET) < 0) rwerror("SEEK", blk); else if (read(fd, buf, (int)size) == size) return (0); rwerror("READ", blk); - if (lseek(fd, offset, 0) < 0) + if (lseek(fd, offset, SEEK_SET) < 0) rwerror("SEEK", blk); errs = 0; memset(buf, 0, (size_t)size); printf("THE FOLLOWING DISK SECTORS COULD NOT BE READ:"); for (cp = buf, i = 0; i < size; i += secsize, cp += secsize) { if (read(fd, cp, (int)secsize) != secsize) { - (void)lseek(fd, offset + i + secsize, 0); + (void)lseek(fd, offset + i + secsize, SEEK_SET); if (secsize != dev_bsize && dev_bsize != 1) printf(" %ld (%ld),", (blk * dev_bsize + i) / secsize, @@ -342,19 +342,19 @@ bwrite(int fd, char *buf, daddr_t blk, long size) return; offset = blk; offset *= dev_bsize; - if (lseek(fd, offset, 0) < 0) + if (lseek(fd, offset, SEEK_SET) < 0) rwerror("SEEK", blk); else if (write(fd, buf, (int)size) == size) { fsmodified = 1; return; } rwerror("WRITE", blk); - if (lseek(fd, offset, 0) < 0) + if (lseek(fd, offset, SEEK_SET) < 0) rwerror("SEEK", blk); printf("THE FOLLOWING SECTORS COULD NOT BE WRITTEN:"); for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize) if (write(fd, cp, (int)dev_bsize) != dev_bsize) { - (void)lseek(fd, offset + i + dev_bsize, 0); + (void)lseek(fd, offset + i + dev_bsize, SEEK_SET); printf(" %ld,", blk + i / dev_bsize); } printf("\n"); diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c index eb2bf9c548a..3a73344d91f 100644 --- a/sbin/growfs/growfs.c +++ b/sbin/growfs/growfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: growfs.c,v 1.15 2006/03/31 08:13:07 pedro Exp $ */ +/* $OpenBSD: growfs.c,v 1.16 2006/04/02 00:48:35 deraadt Exp $ */ /* * Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz * Copyright (c) 1980, 1989, 1993 The Regents of the University of California. @@ -46,7 +46,7 @@ static const char copyright[] = Copyright (c) 1980, 1989, 1993 The Regents of the University of California.\n\ All rights reserved.\n"; -static const char rcsid[] = "$OpenBSD: growfs.c,v 1.15 2006/03/31 08:13:07 pedro Exp $"; +static const char rcsid[] = "$OpenBSD: growfs.c,v 1.16 2006/04/02 00:48:35 deraadt Exp $"; #endif /* not lint */ /* ********************************************************** INCLUDES ***** */ @@ -1497,7 +1497,7 @@ rdfs(daddr_t bno, size_t size, void *bf, int fsi) DBG_ENTER; - if (lseek(fsi, (off_t)bno * DEV_BSIZE, 0) < 0) { + if (lseek(fsi, (off_t)bno * DEV_BSIZE, SEEK_SET) < 0) { err(33, "rdfs: seek error: %ld", (long)bno); } n = read(fsi, bf, size); diff --git a/sbin/modload/a.out.c b/sbin/modload/a.out.c index b969aea92c0..7fe3325c0c2 100644 --- a/sbin/modload/a.out.c +++ b/sbin/modload/a.out.c @@ -1,4 +1,4 @@ -/* $OpenBSD: a.out.c,v 1.4 2002/12/11 18:28:22 deraadt Exp $ */ +/* $OpenBSD: a.out.c,v 1.5 2006/04/02 00:48:35 deraadt Exp $ */ /* $NetBSD: a.out.c,v 1.1 1999/06/13 12:54:40 mrg Exp $ */ /* @@ -149,7 +149,7 @@ a_out_mod_load(int fd) /* * Seek to the text offset to start loading... */ - if (lseek(fd, N_TXTOFF(sinfo_buf), 0) == -1) + if (lseek(fd, N_TXTOFF(sinfo_buf), SEEK_SET) == -1) err(12, "lseek"); /* diff --git a/sbin/ncheck_ffs/ncheck_ffs.c b/sbin/ncheck_ffs/ncheck_ffs.c index 93ecf017de0..88cc670ef07 100644 --- a/sbin/ncheck_ffs/ncheck_ffs.c +++ b/sbin/ncheck_ffs/ncheck_ffs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncheck_ffs.c,v 1.25 2005/11/12 15:26:23 deraadt Exp $ */ +/* $OpenBSD: ncheck_ffs.c,v 1.26 2006/04/02 00:48:35 deraadt Exp $ */ /*- * Copyright (c) 1995, 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com> @@ -26,7 +26,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: ncheck_ffs.c,v 1.25 2005/11/12 15:26:23 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: ncheck_ffs.c,v 1.26 2006/04/02 00:48:35 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -217,7 +217,7 @@ bread(daddr_t blkno, char *buf, int size) int cnt, i; loop: - if (lseek(diskfd, ((off_t)blkno << dev_bshift), 0) < 0) + if (lseek(diskfd, ((off_t)blkno << dev_bshift), SEEK_SET) < 0) warnx("bread: lseek fails"); if ((cnt = read(diskfd, buf, size)) == size) return; @@ -248,7 +248,7 @@ loop: */ memset(buf, 0, size); for (i = 0; i < size; i += dev_bsize, buf += dev_bsize, blkno++) { - if (lseek(diskfd, ((off_t)blkno << dev_bshift), 0) < 0) + if (lseek(diskfd, ((off_t)blkno << dev_bshift), SEEK_SET) < 0) warnx("bread: lseek2 fails!"); if ((cnt = read(diskfd, buf, (int)dev_bsize)) == dev_bsize) continue; diff --git a/sbin/pdisk/file_media.c b/sbin/pdisk/file_media.c index 0c235e5a249..126e680af7d 100644 --- a/sbin/pdisk/file_media.c +++ b/sbin/pdisk/file_media.c @@ -179,7 +179,7 @@ compute_block_size(int fd) if (size == 0) { break; } - if ((x = llseek(fd, (loff_t)0, 0)) < 0) { + if ((x = llseek(fd, (loff_t)0, SEEK_SET)) < 0) { error(errno, "Can't seek on file"); break; } @@ -214,7 +214,7 @@ open_file_as_media(char *file, int oflag) if (a != 0) { a->m.kind = file_info.kind; a->m.grain = compute_block_size(fd); - off = llseek(fd, (loff_t)0, 2); /* seek to end of media */ + off = llseek(fd, (loff_t)0, SEEK_END); /* seek to end of media */ #if !defined(__linux__) && !defined(__unix__) if (off <= 0) { off = 1; /* XXX not right? */ @@ -274,7 +274,7 @@ read_file_media(MEDIA m, long long offset, unsigned long count, void *address) } else { /* do the read */ off = offset; - if ((off = llseek(a->fd, off, 0)) >= 0) { + if ((off = llseek(a->fd, off, SEEK_SET)) >= 0) { if ((t = read(a->fd, address, count)) == count) { rtn_value = 1; } else { @@ -311,7 +311,7 @@ write_file_media(MEDIA m, long long offset, unsigned long count, void *address) } else { /* do the write */ off = offset; - if ((off = llseek(a->fd, off, 0)) >= 0) { + if ((off = llseek(a->fd, off, SEEK_SET)) >= 0) { if ((t = write(a->fd, address, count)) == count) { if (off + count > a->m.size_in_bytes) { a->m.size_in_bytes = off + count; diff --git a/usr.bin/less/ch.c b/usr.bin/less/ch.c index 0966dca9872..b96fbc12f49 100644 --- a/usr.bin/less/ch.c +++ b/usr.bin/less/ch.c @@ -190,7 +190,7 @@ fch_get() */ if (!(ch_flags & CH_CANSEEK)) return ('?'); - if (lseek(ch_file, (off_t)pos, 0) == BAD_LSEEK) + if (lseek(ch_file, (off_t)pos, SEEK_SET) == BAD_LSEEK) { error("seek error", NULL_PARG); clear_eol(); @@ -620,7 +620,7 @@ ch_flush() } #endif - if (lseek(ch_file, (off_t)0, 0) == BAD_LSEEK) + if (lseek(ch_file, (off_t)0, SEEK_SET) == BAD_LSEEK) { /* * Warning only; even if the seek fails for some reason, @@ -709,7 +709,7 @@ seekable(f) return (0); } #endif - return (lseek(f, (off_t)1, 0) != BAD_LSEEK); + return (lseek(f, (off_t)1, SEEK_SET) != BAD_LSEEK); } /* diff --git a/usr.bin/less/decode.c b/usr.bin/less/decode.c index 1737327855f..586b98afa97 100644 --- a/usr.bin/less/decode.c +++ b/usr.bin/less/decode.c @@ -681,7 +681,7 @@ lesskey(filename, sysvar) close(f); return (-1); } - if (lseek(f, (off_t)0, 0) == BAD_LSEEK) + if (lseek(f, (off_t)0, SEEK_SET) == BAD_LSEEK) { free(buf); close(f); diff --git a/usr.bin/less/edit.c b/usr.bin/less/edit.c index bc0eca8dd3e..564ad5e9398 100644 --- a/usr.bin/less/edit.c +++ b/usr.bin/less/edit.c @@ -724,7 +724,7 @@ loop: * Append: open the file and seek to the end. */ logfile = open(filename, OPEN_APPEND); - if (lseek(logfile, (off_t)0, 2) == BAD_LSEEK) + if (lseek(logfile, (off_t)0, SEEK_END) == BAD_LSEEK) { close(logfile); logfile = -1; diff --git a/usr.bin/less/filename.c b/usr.bin/less/filename.c index 4e76843c95b..40c52c1d85a 100644 --- a/usr.bin/less/filename.c +++ b/usr.bin/less/filename.c @@ -492,7 +492,7 @@ bin_file(f) if (!seekable(f)) return (0); - if (lseek(f, (off_t)0, 0) == BAD_LSEEK) + if (lseek(f, (off_t)0, SEEK_SET) == BAD_LSEEK) return (0); n = read(f, data, sizeof(data)); for (i = 0; i < n; i++) @@ -510,7 +510,7 @@ seek_filesize(f) { off_t spos; - spos = lseek(f, (off_t)0, 2); + spos = lseek(f, (off_t)0, SEEK_END); if (spos == BAD_LSEEK) return (NULL_POSITION); return ((POSITION) spos); diff --git a/usr.bin/mail/fio.c b/usr.bin/mail/fio.c index bb03ebc6e1f..6aaed2d0bb5 100644 --- a/usr.bin/mail/fio.c +++ b/usr.bin/mail/fio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fio.c,v 1.25 2004/05/10 15:25:51 deraadt Exp $ */ +/* $OpenBSD: fio.c,v 1.26 2006/04/02 00:51:37 deraadt Exp $ */ /* $NetBSD: fio.c,v 1.8 1997/07/07 22:57:55 phil Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static const char sccsid[] = "@(#)fio.c 8.2 (Berkeley) 4/20/95"; #else -static const char rcsid[] = "$OpenBSD: fio.c,v 1.25 2004/05/10 15:25:51 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: fio.c,v 1.26 2006/04/02 00:51:37 deraadt Exp $"; #endif #endif /* not lint */ @@ -292,7 +292,7 @@ makemessage(FILE *f, int omsgCount) message = nmessage; size -= (omsgCount + 1) * sizeof(struct message); fflush(f); - (void)lseek(fileno(f), (off_t)sizeof(*message), 0); + (void)lseek(fileno(f), (off_t)sizeof(*message), SEEK_SET); if (myread(fileno(f), (void *) &message[omsgCount], size) != size) errx(1, "Message temporary file corrupted"); message[msgCount].m_size = 0; diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c index 255164380a4..1569cef43af 100644 --- a/usr.sbin/edquota/edquota.c +++ b/usr.sbin/edquota/edquota.c @@ -38,7 +38,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)edquota.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$Id: edquota.c,v 1.43 2005/11/12 15:26:23 deraadt Exp $"; +static char *rcsid = "$Id: edquota.c,v 1.44 2006/04/02 00:50:40 deraadt Exp $"; #endif /* not lint */ /* @@ -333,7 +333,7 @@ putprivs(long id, int quotatype, struct quotause *quplist) if ((fd = open(qup->qfname, O_WRONLY)) < 0) { perror(qup->qfname); } else { - lseek(fd, (off_t)(id * sizeof (struct dqblk)), 0); + lseek(fd, (off_t)(id * sizeof (struct dqblk)), SEEK_SET); if (write(fd, &qup->dqblk, sizeof (struct dqblk)) != sizeof (struct dqblk)) warn("%s", qup->qfname); diff --git a/usr.sbin/fdformat/fdformat.c b/usr.sbin/fdformat/fdformat.c index c1ba5328c85..748b21d4a39 100644 --- a/usr.sbin/fdformat/fdformat.c +++ b/usr.sbin/fdformat/fdformat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdformat.c,v 1.13 2006/03/12 02:45:45 deraadt Exp $ */ +/* $OpenBSD: fdformat.c,v 1.14 2006/04/02 00:50:42 deraadt Exp $ */ /* * Copyright (C) 1992-1994 by Joerg Wunsch, Dresden @@ -118,7 +118,7 @@ verify_track(int fd, int track, int tracksize) fprintf (stderr, "\nfdformat: out of memory\n"); exit (2); } - if (lseek (fd, (off_t) track*tracksize, 0) < 0) + if (lseek (fd, (off_t) track*tracksize, SEEK_SET) < 0) rv = -1; /* try twice reading it, without using the normal retrier */ else if (read (fd, buf, tracksize) != tracksize diff --git a/usr.sbin/quot/quot.c b/usr.sbin/quot/quot.c index 3641ce0ac4c..ade893d3151 100644 --- a/usr.sbin/quot/quot.c +++ b/usr.sbin/quot/quot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: quot.c,v 1.14 2003/08/25 23:28:16 tedu Exp $ */ +/* $OpenBSD: quot.c,v 1.15 2006/04/02 00:50:42 deraadt Exp $ */ /* $NetBSD: quot.c,v 1.7.4.1 1996/05/31 18:06:36 jtc Exp $ */ /* @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: quot.c,v 1.14 2003/08/25 23:28:16 tedu Exp $"; +static char rcsid[] = "$Id: quot.c,v 1.15 2006/04/02 00:50:42 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -100,7 +100,7 @@ get_inode(int fd, struct fs *super, ino_t ino) last = (ino / INOCNT(super)) * INOCNT(super); if (lseek(fd, (off_t)ino_to_fsba(super, last) << super->fs_fshift, - 0) < 0 + SEEK_SET) < 0 || read(fd, ip, INOSZ(super)) != INOSZ(super)) { err(1, "read inodes"); } @@ -523,7 +523,7 @@ quot(char *name, char *mp) warn("%s", name); return; } - if (lseek(fd, SBOFF, 0) != SBOFF + if (lseek(fd, SBOFF, SEEK_SET) != SBOFF || read(fd, superblock, SBSIZE) != SBSIZE || ((struct fs *)superblock)->fs_magic != FS_MAGIC || ((struct fs *)superblock)->fs_bsize > MAXBSIZE diff --git a/usr.sbin/rarpd/rarpd.c b/usr.sbin/rarpd/rarpd.c index 9b9015be016..39376638d21 100644 --- a/usr.sbin/rarpd/rarpd.c +++ b/usr.sbin/rarpd/rarpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rarpd.c,v 1.46 2006/01/23 17:29:22 millert Exp $ */ +/* $OpenBSD: rarpd.c,v 1.47 2006/04/02 00:50:42 deraadt Exp $ */ /* $NetBSD: rarpd.c,v 1.25 1998/04/23 02:48:33 mrg Exp $ */ /* @@ -28,7 +28,7 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char rcsid[] = "$OpenBSD: rarpd.c,v 1.46 2006/01/23 17:29:22 millert Exp $"; +static char rcsid[] = "$OpenBSD: rarpd.c,v 1.47 2006/04/02 00:50:42 deraadt Exp $"; #endif @@ -451,7 +451,7 @@ rarp_loop(void) if (cc < 0) { if (errno == EINVAL && (lseek(fd, (off_t)0, SEEK_CUR) + bufsize) < 0) { - (void) lseek(fd, (off_t)0, 0); + (void) lseek(fd, (off_t)0, SEEK_SET); goto again; } error(FATAL, "read: %s", strerror(errno)); |