diff --git a/stdio/file.c b/stdio/file.c index c54d207c..d2080287 100644 --- a/stdio/file.c +++ b/stdio/file.c @@ -1439,15 +1439,20 @@ void funlockfile(FILE *file) FILE *tmpfile(void) { oid_t oid, dev; + int ret; - while (lookup("/dev/posix/tmpfile", &oid, &dev) < 0) { - if (errno != EINTR) { - return NULL; - } + do { + ret = lookup("/dev/posix/tmpfile", &oid, &dev); + } while (ret == -EINTR); + + if (ret < 0) { + errno = abs(ret); + return NULL; } /* Make sure it's a device (created by posixsrv) */ if (oid.port == dev.port) { + errno = ENODEV; return NULL; }