[klibc] Don't set the file pointer to -1 if unseekable

For unseekable files, don't set the file pointer to -1.  Although
it is arguably meaningless anyway, there might be problems with having
the stdio file pointer be negative.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
diff --git a/usr/klibc/stdio/fdopen.c b/usr/klibc/stdio/fdopen.c
index a12efe5..e4226e9 100644
--- a/usr/klibc/stdio/fdopen.c
+++ b/usr/klibc/stdio/fdopen.c
@@ -21,6 +21,7 @@
 	const size_t bufoffs =
 		(sizeof *f + 4*sizeof(void *) - 1) &
 		~(4*sizeof(void *) - 1);
+	off_t pos;
 
 	(void)mode;
 
@@ -30,7 +31,8 @@
 
 	f->data = f->buf = (char *)f + bufoffs;
 	f->pub._io_fileno = fd;
-	f->pub._io_filepos = lseek(fd, 0, SEEK_CUR);
+	pos = lseek(fd, 0, SEEK_CUR);
+	f->pub._io_filepos = (pos >= 0) ? pos : 0;
 	f->bufsiz = BUFSIZ;
 	f->bufmode = isatty(fd) ? _IOLBF : _IOFBF;