projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d2b0c77
)
Preserve errno.
author
Bruno Haible
<bruno@clisp.org>
Fri, 9 Mar 2007 02:41:51 +0000
(
02:41
+0000)
committer
Bruno Haible
<bruno@clisp.org>
Fri, 9 Mar 2007 02:41:51 +0000
(
02:41
+0000)
lib/fseterr.c
patch
|
blob
|
history
diff --git
a/lib/fseterr.c
b/lib/fseterr.c
index 5ff8ba7e79263d33636b832a12b6aa3d51532afc..3f876155b3fda74f4f31045a683ea275f9f5dfc1 100644
(file)
--- a/
lib/fseterr.c
+++ b/
lib/fseterr.c
@@
-20,6
+20,8
@@
/* Specification. */
#include "fseterr.h"
+#include <errno.h>
+
void
fseterr (FILE *fp)
{
@@
-35,9
+37,11
@@
fseterr (FILE *fp)
#else /* unknown */
/* Portable fallback, based on an idea by Rich Felker.
Wow! 6 system calls for something that is just a bit operation! */
+ int saved_errno;
int fd;
int fd2;
+ saved_errno = errno;
fflush (fp);
fd = fileno (fp);
fd2 = dup (fd);
@@
-51,5
+55,6
@@
fseterr (FILE *fp)
abort ();
close (fd2);
}
+ errno = saved_errno;
#endif
}