summaryrefslogtreecommitdiff
blob: 025f3635d5c7b054e194ee2e356acd3f45201c31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
diff -Nru wvstreams-4.2.1.orig/streams/wvmodem.cc wvstreams-4.2.1/streams/wvmodem.cc
--- wvstreams-4.2.1.orig/streams/wvmodem.cc	2005-11-17 22:45:09.000000000 +0200
+++ wvstreams-4.2.1/streams/wvmodem.cc	2005-12-24 10:00:36.990262500 +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.