apply some fixes from OpenBSD and don't apply some others
but sync RCS IDs for easier future adaption: * Simplify savefd() by removing the "noclose" flag and make noclose behavior the default. Almost all uses of savefd() are followed by an implicit or explicit close. * fix typos * might as well make ksh_getopt() match real getopt(), ie. get rid of that stupid EOF concept that was never true. adobriyan@gmail * use SEEK_* for lseek() * fix lint comments, no functional changes * remove excessive optimization; from adobriyan@gmail * only santa checks things twice; from adobriyan@gmail * Interpret zero-filled numbers as decimal; PR 4213; from Alexey Dobriyan
This commit is contained in:
6
shf.c
6
shf.c
@@ -1,8 +1,8 @@
|
||||
/* $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 $ */
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.4 2006/01/29 20:04:53 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.5 2006/05/10 18:54:12 tg Exp $");
|
||||
|
||||
/* flags to shf_emptybuf() */
|
||||
#define EB_READSW 0x01 /* about to switch to reading */
|
||||
@@ -280,7 +280,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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user