diff -Nru wvstreams-4.3.orig/streams/wvmodem.cc wvstreams-4.3/streams/wvmodem.cc --- wvstreams-4.3.orig/streams/wvmodem.cc 2007-02-07 21:06:17.000000000 +0200 +++ wvstreams-4.3/streams/wvmodem.cc 2007-03-12 13:49:13.000000000 +0200 @@ -194,22 +194,22 @@ drain(); #if HAVE_LINUX_SERIAL_H - struct serial_struct old_sinfo, sinfo; - sinfo.reserved_char[0] = 0; - if (ioctl(getrfd(), TIOCGSERIAL, &old_sinfo) < 0) - log("Cannot get information for serial port."); - else - { - sinfo = old_sinfo; - // Why there are two closing wait timeouts, is beyond me - // but there are... apparently the second one is deprecated - // but why take a chance... - sinfo.closing_wait = ASYNC_CLOSING_WAIT_NONE; - sinfo.closing_wait2 = ASYNC_CLOSING_WAIT_NONE; - - if (ioctl(getrfd(), TIOCSSERIAL, &sinfo) < 0) - log("Cannot set information for serial port."); - } + if (getuid() == 0) + { + struct serial_struct sinfo; + if (ioctl(getrfd(), TIOCGSERIAL, &sinfo) >= 0) //Ignore errors because some modems (at least slmodem) do not support this + { + // Why there are two closing wait timeouts, is beyond me + // but there are... apparently the second one is deprecated + // but why take a chance... + sinfo.closing_wait = ASYNC_CLOSING_WAIT_NONE; + sinfo.closing_wait2 = ASYNC_CLOSING_WAIT_NONE; + + //Ignore errors because ltmodem module implement TIOCGSERIAL but do not implement TIOCSSERIAL (go figure...) + //see http://bugs.gentoo.org/show_bug.cgi?id=85754 + ioctl(getrfd(), TIOCSSERIAL, &sinfo); + } + } #endif // set up the terminal characteristics.