DragonFly BSD
DragonFly bugs List (threaded) for 2004-10
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: cu coredumps


From: Timour Ezeev <timour@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 28 Oct 2004 18:54:34 -0400 (Eastern Daylight Time)

On Tue, 26 Oct 2004, Mark Cullen wrote:

I managed to update to HEAD a few hours before you announced slipping the Stable tag (I think). While I don't actually need to use cu on this machine, I did discover it seems to core dump...

(root|beast)/home/mrboo# cu -l cuaa0
zsh: segmentation fault (core dumped)  cu -l cuaa0
(root|beast)/home/mrboo# cu -l cuaa1
zsh: segmentation fault (core dumped)  cu -l cuaa1
(root|beast)/home/mrboo#

...


Sorry to bring this subject up again, but I finally had a chance to examine the source code. Here is a patch that I think addresses the problem with minimal modification to the original code and algorithm. Instead of adding a prefix to a device name it simply bails out (this of course can be changed). The main difference with the suggested fix is that this patch fixes the lookup procedure rather then creating a hack around it.

Regards,

- Timour

--
Timour Ezeev
Pivotal Dynamics
timour@xxxxxxxxxxxxxxxxxxx
V: 305.406.9904
F: 305.406.9689

Index: remote.c
===================================================================
RCS file: /home/dcvs/src/usr.bin/tip/tip/remote.c,v
retrieving revision 1.3
diff -u -r1.3 remote.c
--- remote.c	3 Nov 2003 19:31:33 -0000	1.3
+++ remote.c	28 Oct 2004 22:18:17 -0000
@@ -120,17 +120,21 @@
 		}

 	if ((stat = cgetent(&bp, db_array, host)) < 0) {
-		if (DV ||
-		    (host[0] == '/' && access(DV = host, R_OK | W_OK) == 0)) {
-			CU = DV;
-			HO = host;
-			HW = 1;
-			DU = 0;
-			if (!BR)
-				BR = DEFBR;
-			FS = DEFFS;
-			return;
+		/* Check for valid device */
+		if (DV && access(DV, R_OK | W_OK) != 0) {
+			err(errno, "bad device `%s\'", DV);
 		}
+		else
+			if (DV || host[0] == '/' && access(DV = host, R_OK | W_OK) == 0) {
+				CU = DV;
+				HO = host;
+				HW = 1;
+				DU = 0;
+				if (!BR)
+					BR = DEFBR;
+				FS = DEFFS;
+				return;
+			}
 		switch(stat) {
 		case -1:
 			warnx("unknown host %s", host);




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]