Commit d352eb9
committed
remove outdated workaround for OpenBSD fclose() calling close()
Test program:
```c
#include <sys/utsname.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
static int closed;
int
close(int unused)
{
closed = 1;
return 0;
}
int main()
{
struct utsname os;
int fd;
FILE *file;
char *closed_str[] = {" not", ""};
uname(&os);
if ((fd = open("/dev/null", O_RDONLY)) == -1)
return 1;
if ((file = fdopen(fd, "rb")) == NULL)
return 1;
printf("Operating system: %s/%s %s %s\n", os.sysname, os.machine,
os.release, os.version);
closed = 0;
fclose(stdin);
printf("close()%s called on stdin\n", closed_str[closed]);
closed = 0;
fclose(file);
printf("close()%s called on nonstd stream\n", closed_str[closed]);
}
```
Output:
```console
$ ./a.out
Operating system: OpenBSD/amd64 7.4 GENERIC.MP#0
close() not called on stdin
close() not called on nonstd stream
```1 parent d5cc80a commit d352eb9
2 files changed
+2
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | 223 | | |
227 | 224 | | |
228 | 225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
560 | 560 | | |
561 | 561 | | |
562 | 562 | | |
563 | | - | |
564 | 563 | | |
565 | | - | |
566 | 564 | | |
567 | 565 | | |
568 | 566 | | |
| |||
639 | 637 | | |
640 | 638 | | |
641 | 639 | | |
642 | | - | |
| 640 | + | |
643 | 641 | | |
644 | 642 | | |
645 | 643 | | |
| |||
0 commit comments