patches/ORBit-05-fixhypen.diff
author dcarbery
Fri, 24 Nov 2006 16:37:59 +0000
branch217update
changeset 19096 d542fc2c823e
parent 8202 1247bda52fb6
permissions -rw-r--r--
Merged trunk changes r9797:9829 into 217update branch.

Index: ORBit2/ChangeLog
===================================================================
RCS file: /export/cvs/head/ORBit2/ChangeLog,v
retrieving revision 1.754
diff -p -U5 -r1.754 ChangeLog
--- ORBit2/ChangeLog	20 May 2006 11:40:37 -0000	1.754
+++ ORBit2/ChangeLog	26 Sep 2006 10:26:03 -0000
@@ -1,3 +1,8 @@
+2006-09-26  Manjunath K V  <[email protected]>
+	* src/orb/GIOP/giop.c: (scan_socket_dir): Patch to fix
+	the warning message for users with similar prefixes.
+	Fixes bug #152659.
+
 2006-07-24  Kjartan Maraas  <[email protected]>
 
 	* Makefile.am: Dist gtk-doc.make too.
Index: ORBit2/src/orb/GIOP/giop.c
===================================================================
RCS file: /export/cvs/head/ORBit2/src/orb/GIOP/giop.c,v
retrieving revision 1.53
diff -p -U5 -r1.53 giop.c
--- ORBit2/src/orb/GIOP/giop.c	8 Sep 2005 09:03:58 -0000	1.53
+++ ORBit2/src/orb/GIOP/giop.c	26 Sep 2006 10:26:03 -0000
@@ -70,26 +70,32 @@ test_safe_socket_dir (const char *dirnam
  */
 static char *
 scan_socket_dir (const char *dir, const char *prefix)
 {
 	int prefix_len;
+	int len;
 	char *cur_dir = NULL;
 	GDir   *dirh;
 	const char *dent;
+	char *prefix_with_hyphen;
 
 	g_return_val_if_fail (dir != NULL, NULL);
 	g_return_val_if_fail (prefix != NULL, NULL);
 	
 	dirh = g_dir_open (dir, 0, NULL);
 	if (!dirh)
 		return NULL;
-	prefix_len = strlen (prefix);
+
+	prefix_with_hyphen = g_strdup_printf ("%s-", prefix);
+	prefix_len = strlen (prefix_with_hyphen);
 
 	while ((dent = g_dir_read_name (dirh))) {
 		char *name;
+		len = (strlen (dent) > strlen (prefix)) ? strlen (dent) : strlen (prefix);
 
-		if (strncmp (dent, prefix, prefix_len))
+		if (strncmp (dent, prefix, len) && 
+		    strncmp (dent, prefix_with_hyphen, prefix_len))
 			continue;
 
 		name = g_build_filename (dir, dent, NULL);
 
 		/* Check it's credentials */
@@ -105,10 +111,12 @@ scan_socket_dir (const char *dir, const 
 			cur_dir = name;
 		} else
 			g_free (name);
 	}
 	g_dir_close (dirh);
+
+	g_free (prefix_with_hyphen);
 
 	return cur_dir;
 }
 
 static void