[PATCH] modify find_cached_server string semantics (was: Problems with SMB module)
- From: Christian Neumair <chris gnome-de org>
- To: Philippe Normand <philippe fluendo com>
- Cc: gnome-vfs-list gnome org
- Subject: [PATCH] modify find_cached_server string semantics (was: Problems with SMB module)
- Date: Thu, 30 Mar 2006 14:59:16 +0200
Am Mittwoch, den 29.03.2006, 09:58 +0200 schrieb Philippe Normand:
> Hi,
>
> I'm browsing a local Samba share using either
> nautilus or gnome-python gnomevfs package.. It works like a charm
> excepted that my samba server forks *lots* of process, and these
> connections are never closed. I ended with about 200 smbd processes, and
> a loadavg of 195 ...
>
> If i try to browse my share using smbclient, smbd forks one process
> which is killed when i exit smbclient. This makes me think there could
> be a bug in GnomeVFS SMB module.. What's your opinion ?
>
> What can i do to help solve the problem ? I'm using Gnome 2.14.
I haven't ever touched the smb method, but I could reproduce your issue
and tried to fix it by making find_cached_server use similar string
semantics as add_cached_server. After applying it, the cache lookup WFM
as expected and the smbd spawning paranoia stops.
--
Christian Neumair <chris gnome-de org>
Index: modules/smb-method.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/smb-method.c,v
retrieving revision 1.36
diff -u -p -r1.36 smb-method.c
--- modules/smb-method.c 28 Feb 2006 12:27:35 -0000 1.36
+++ modules/smb-method.c 30 Mar 2006 12:55:22 -0000
@@ -190,6 +188,14 @@ string_ndup_nzero (const gchar *s, const
return NULL;
return g_strndup (s, n);
}
+
+static const char*
+string_nzero (const gchar *s)
+{
+ if (!s || !s[0])
+ return NULL;
+ return s;
+}
static gboolean
string_compare (const char *a, const char *b)
@@ -384,10 +390,11 @@ find_cached_server (const char *server_n
DEBUG_SMB(("find_cached_server: server: %s, share: %s, domain: %s, user: %s\n", server_name, share_name, domain, username));
- entry.server_name = (char *)server_name;
- entry.share_name = (char *)share_name;
- entry.domain = (char *)domain;
- entry.username = (char *)username;
+ /* "" must be treated as NULL, because add_cached_server() uses string_dup_nzero() */
+ entry.server_name = (char *) string_nzero (server_name);
+ entry.share_name = (char *) string_nzero (share_name);
+ entry.domain = (char *) string_nzero (domain);
+ entry.username = (char *) string_nzero (username);
res = g_hash_table_lookup (server_cache, &entry);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]