Update to FreeBSD head 2017-08-01

Git mirror commit f5002f5e5f78cae9f0269d812dc0aedb0339312c.

Update #3472.
This commit is contained in:
Sebastian Huber
2018-08-07 14:56:50 +02:00
parent de261e0404
commit c37f9fba70
169 changed files with 6857 additions and 3262 deletions

View File

@@ -87,22 +87,25 @@ char *
fgetln(FILE *fp, size_t *lenp)
{
unsigned char *p;
char *ret;
size_t len;
size_t off;
#ifndef __rtems__
FLOCKFILE_CANCELSAFE(fp);
#else /* __rtems__ */
FLOCKFILE(fp);
#endif /* __rtems__ */
ORIENT(fp, -1);
/* make sure there is input */
if (fp->_r <= 0 && __srefill(fp)) {
*lenp = 0;
FUNLOCKFILE(fp);
return (NULL);
ret = NULL;
goto end;
}
/* look for a newline in the input */
if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) != NULL) {
char *ret;
/*
* Found one. Flag buffer as modified to keep fseek from
* `optimising' a backward seek, in case the user stomps on
@@ -116,8 +119,7 @@ fgetln(FILE *fp, size_t *lenp)
#endif /* __rtems__ */
fp->_r -= len;
fp->_p = p;
FUNLOCKFILE(fp);
return (ret);
goto end;
}
/*
@@ -167,12 +169,18 @@ fgetln(FILE *fp, size_t *lenp)
#ifdef notdef
fp->_lb._base[len] = '\0';
#endif
ret = (char *)fp->_lb._base;
end:
#ifndef __rtems__
FUNLOCKFILE_CANCELSAFE();
#else /* __rtems__ */
FUNLOCKFILE(fp);
return ((char *)fp->_lb._base);
#endif /* __rtems__ */
return (ret);
error:
*lenp = 0; /* ??? */
fp->_flags |= __SERR;
FUNLOCKFILE(fp);
return (NULL); /* ??? */
ret = NULL;
goto end;
}