X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=support%2Fnfs%2Fxio.c;h=49ee6bc2eac3da43fc0d0dccd4330f7ccf38edaf;hb=ae49af676494d288b872ee314af7cb632d211d7a;hp=1bcd41bc8b1a9eb46bc21af60f5168276ff5688f;hpb=8b7ad01b14df1e7529b9ba8a1ea17df0d6004ef9;p=nfs-utils.git diff --git a/support/nfs/xio.c b/support/nfs/xio.c index 1bcd41b..49ee6bc 100644 --- a/support/nfs/xio.c +++ b/support/nfs/xio.c @@ -92,7 +92,7 @@ xgettok(XFILE *xfp, char sepa, char *tok, int len) while (i < len && (c = xgetc(xfp)) != EOF && c != sepa && !isspace(c)) tok[i++] = c; if (c == '\n') - ungetc(c, xfp->x_fp); + xungetc(c, xfp); if (!i) return 0; if (i >= len || (sepa && c != sepa)) @@ -126,10 +126,14 @@ xgetc(XFILE *xfp) } void -xungetc(char c, XFILE *xfp) +xungetc(int c, XFILE *xfp) { - if (c != EOF) - ungetc(c, xfp->x_fp); + if (c == EOF) + return; + + ungetc(c, xfp->x_fp); + if (c == '\n') + xfp->x_line--; } void