diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 93003ff51..5ff53ed53 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,4 +1,16 @@ -2013-10-25 Corinna Vinschen +2013-10-26 Corinna Vinschen + + * devices.in (dev_storage): Map /dev/dsp to \Device\Null. + * devices.cc: Regenerate. + * fhandler_dsp.cc (fhandler_dev_dsp::open): Call fhandler_base::open. + (fhandler_dev_dsp::close): Call fhandler_base::close. + (fhandler_dev_dsp::fixup_after_fork): Call + fhandler_base::fixup_after_fork. + + * fhandler_raw.cc (fhandler_dev_raw::fixup_after_fork): Call + fhandler_base::fixup_after_fork. + +2013-10-26 Corinna Vinschen * exception.h (_exception_list): Drop redefinition for x86_64. * include/exceptions.h: Disable content for x86_64 since it's not diff --git a/winsup/cygwin/devices.cc b/winsup/cygwin/devices.cc index 6c6960c2f..539dba3d8 100644 --- a/winsup/cygwin/devices.cc +++ b/winsup/cygwin/devices.cc @@ -226,7 +226,7 @@ const _RDATA device dev_storage[] = {"/dev/cons62", BRACK(FHDEV(DEV_CONS_MAJOR, 62)), "/dev/cons62", exists_console, S_IFCHR, true}, {"/dev/cons63", BRACK(FHDEV(DEV_CONS_MAJOR, 63)), "/dev/cons63", exists_console, S_IFCHR, true}, {"/dev/console", BRACK(FH_CONSOLE), "/dev/console", exists_console, S_IFCHR, true}, - {"/dev/dsp", BRACK(FH_OSS_DSP), "/dev/dsp", exists, S_IFCHR, true}, + {"/dev/dsp", BRACK(FH_OSS_DSP), "\\Device\\Null", exists_ntdev, S_IFCHR, true}, {"/dev/fd0", BRACK(FHDEV(DEV_FLOPPY_MAJOR, 0)), "\\Device\\Floppy0", exists_ntdev, S_IFBLK, true}, {"/dev/fd1", BRACK(FHDEV(DEV_FLOPPY_MAJOR, 1)), "\\Device\\Floppy1", exists_ntdev, S_IFBLK, true}, {"/dev/fd2", BRACK(FHDEV(DEV_FLOPPY_MAJOR, 2)), "\\Device\\Floppy2", exists_ntdev, S_IFBLK, true}, diff --git a/winsup/cygwin/devices.in b/winsup/cygwin/devices.in index ef10557e9..bba5fdd7c 100644 --- a/winsup/cygwin/devices.in +++ b/winsup/cygwin/devices.in @@ -148,7 +148,7 @@ const device dev_error_storage = "/dev/console", BRACK(FH_CONSOLE), "/dev/console", exists_console, S_IFCHR, =console_dev "/dev/ptmx", BRACK(FH_PTMX), "/dev/ptmx", exists, S_IFCHR "/dev/windows", BRACK(FH_WINDOWS), "/dev/windows", exists, S_IFCHR -"/dev/dsp", BRACK(FH_OSS_DSP), "/dev/dsp", exists, S_IFCHR +"/dev/dsp", BRACK(FH_OSS_DSP), "\\Device\\Null", exists_ntdev, S_IFCHR "/dev/conin", BRACK(FH_CONIN), "/dev/conin", exists_console, S_IFCHR "/dev/conout", BRACK(FH_CONOUT), "/dev/conout", exists_console, S_IFCHR "/dev/null", BRACK(FH_NULL), "\\Device\\Null", exists_ntdev, S_IFCHR diff --git a/winsup/cygwin/fhandler_dsp.cc b/winsup/cygwin/fhandler_dsp.cc index f6ec303f2..80b014219 100644 --- a/winsup/cygwin/fhandler_dsp.cc +++ b/winsup/cygwin/fhandler_dsp.cc @@ -1006,7 +1006,7 @@ fhandler_dev_dsp::fhandler_dev_dsp (): int fhandler_dev_dsp::open (int flags, mode_t mode) { - int err = 0; + int ret = 0, err = 0; UINT num_in = 0, num_out = 0; set_flags ((flags & ~O_TEXT) | O_BINARY); // Work out initial sample format & frequency, /dev/dsp defaults @@ -1032,18 +1032,14 @@ fhandler_dev_dsp::open (int flags, mode_t mode) err = EINVAL; } - if (!err) - { - set_open_status (); - need_fork_fixup (true); - nohandle (true); - } - else + if (err) set_errno (err); + else + ret = fhandler_base::open (flags, mode); - debug_printf ("ACCMODE=%y audio_in=%d audio_out=%d, err=%d", - flags & O_ACCMODE, num_in, num_out, err); - return !err; + debug_printf ("ACCMODE=%y audio_in=%d audio_out=%d, err=%d, ret=%d", + flags & O_ACCMODE, num_in, num_out, err, ret); + return ret; } #define IS_WRITE() ((get_flags() & O_ACCMODE) != O_RDONLY) @@ -1159,7 +1155,7 @@ fhandler_dev_dsp::close () debug_printf ("audio_in=%p audio_out=%p", audio_in_, audio_out_); close_audio_in (); close_audio_out (exit_state != ES_NOT_EXITING); - return 0; + return fhandler_base::close (); } int @@ -1371,6 +1367,7 @@ fhandler_dev_dsp::fixup_after_fork (HANDLE parent) debug_printf ("audio_in=%p audio_out=%p", audio_in_, audio_out_); + fhandler_base::fixup_after_fork (parent); if (audio_in_) audio_in_->fork_fixup (parent); if (audio_out_) diff --git a/winsup/cygwin/fhandler_raw.cc b/winsup/cygwin/fhandler_raw.cc index 04f40f387..23a6beaad 100644 --- a/winsup/cygwin/fhandler_raw.cc +++ b/winsup/cygwin/fhandler_raw.cc @@ -105,8 +105,9 @@ fhandler_dev_raw::dup (fhandler_base *child, int flags) } void -fhandler_dev_raw::fixup_after_fork (HANDLE) +fhandler_dev_raw::fixup_after_fork (HANDLE parent) { + fhandler_base::fixup_after_fork (parent); devbufstart = 0; devbufend = 0; lastblk_to_read (false); diff --git a/winsup/cygwin/release/1.7.26 b/winsup/cygwin/release/1.7.26 index f3965b848..b350703d0 100644 --- a/winsup/cygwin/release/1.7.26 +++ b/winsup/cygwin/release/1.7.26 @@ -8,8 +8,8 @@ What changed: - Slightly improve randomness of /dev/random emulation. - Allow to use advisory locking on any device which is backed by an OS handle. - Right now this excludes /dev/dsp, console windows on pre Windows 8, as well - as almost all virtual files under /proc. + Right now this excludes console windows on pre Windows 8, as well as almost + all virtual files under /proc. Bug fixes: @@ -28,3 +28,7 @@ Bug fixes: Fixes: http://cygwin.com/ml/cygwin/2013-10/threads.html#00237 - Fix a potential crash after calling lseek on /dev/clipboard. + +- Fix a handle inheritance bug in raw disk and tape device handling which + led to EBADF errors in child processes. +