aboutsummaryrefslogtreecommitdiff
path: root/win32/winansi.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-02-22 11:40:53 +0000
committerRon Yorston <rmy@pobox.com>2018-02-22 11:40:53 +0000
commit4e6d0dc9476e5cf43ff0bc5e66a54d812ddb4225 (patch)
tree03dfcab70ff58cae77db6a7ad75dfac3203765c7 /win32/winansi.c
parent1efab55196bea6d93aa26ca2fb1d3d358f16452f (diff)
downloadbusybox-w32-4e6d0dc9476e5cf43ff0bc5e66a54d812ddb4225.tar.gz
busybox-w32-4e6d0dc9476e5cf43ff0bc5e66a54d812ddb4225.tar.bz2
busybox-w32-4e6d0dc9476e5cf43ff0bc5e66a54d812ddb4225.zip
win32: handle /dev/zero and /dev/urandom in open and read functions
Currently /dev/zero is handled as a special case in dd. Add hacks to the open and read functions in mingw.c to handle the zero and urandom devices. - Opening /dev/zero or /dev/urandom actually opens the special Windows file 'nul' which behaves like /dev/null. This allows manipulation of the file descriptor with things like seek and close - When /dev/zero or /dev/urandom is opened the resulting file descriptor is stored and used to override the behaviour of read. - No attempt is made to track duplicated file descriptors, so using these devices for redirections in the shell isn't going to work and won't be permitted. (Could be, but won't.) - Limited control of the special file descriptors is provided by allowing the internal variables to be changed. - The numbers from /dev/urandom aren't very random.
Diffstat (limited to 'win32/winansi.c')
-rw-r--r--win32/winansi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/win32/winansi.c b/win32/winansi.c
index 8fffc5a00..b357fc642 100644
--- a/win32/winansi.c
+++ b/win32/winansi.c
@@ -695,7 +695,7 @@ int winansi_read(int fd, void *buf, size_t count)
695{ 695{
696 int rv; 696 int rv;
697 697
698 rv = read(fd, buf, count); 698 rv = mingw_read(fd, buf, count);
699 if (!isatty(fd)) 699 if (!isatty(fd))
700 return rv; 700 return rv;
701 701