summaryrefslogtreecommitdiff
blob: f5d5215745ce647f97129c09b5297981963eac13 (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 -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.