mocksetup: /unsafe+/hdd -> /quad
[nethome.git] / src / read1.c
1 #define _GNU_SOURCE 1
2 #include <dlfcn.h>
3 #include <unistd.h>
4 #include <fcntl.h>
5 #include <stdlib.h>
6
7 ssize_t
8 read (int fd, void *buf, size_t count)
9 {
10   static ssize_t (*read2) (int fd, void *buf, size_t count) = NULL;
11
12   if (read2 == NULL)
13     {
14       unsetenv ("LD_PRELOAD");
15       read2 = dlsym (RTLD_NEXT, "read");
16     }
17
18   if (count > 0 && isatty (fd) >= 1)
19     count = 1;
20
21   return read2 (fd, buf, count);
22 }