Hi,
this works on Linux:
$ cp file /dev/null
but fails on Cygwin 1.5.25-15:
$ cp file /dev/null
cp: cannot create regular file `/dev/null': Invalid request code
/dev/null exists, so /bin/cp opens it with O_TRUNC only. But this fails
with EBADRQC (54):
fd = open("/dev/null", O_WRONLY|O_TRUNC, .)
According to strace, Cygwin calls:
h = CreateFile("NUL", ., ., TRUNCATE_EXISTING, ., .);
which fails.
Interestingly, this works:
fd = open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, .);
Cygwin calls:
h = CreateFile("NUL", ., ., CREATE_ALWAYS, ., .);
Apparently a subtle (and IMO undocumented) difference between
TRUNCATE_EXISTING and CREATE_ALWAYS even when file exists.
Christian
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/