diff -Nur wvstreams-4.2.2.orig/streams/wvmodem.cc wvstreams-4.2.2/streams/wvmodem.cc --- wvstreams-4.2.2.orig/streams/wvmodem.cc 2005-11-24 21:46:51.000000000 +0200 +++ wvstreams-4.2.2/streams/wvmodem.cc 2006-02-03 21:17:54.993010500 +0200 @@ -192,22 +192,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.