[dovecot-cvs] dovecot/src/master master-settings.c, 1.125.2.22, 1.125.2.23
tss at dovecot.org
tss at dovecot.org
Tue Jan 9 20:30:26 UTC 2007
Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv17898
Modified Files:
Tag: branch_1_0
master-settings.c
Log Message:
Delete all auth-worker.* files from Dovecot's base_dir when starting.
Index: master-settings.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/master-settings.c,v
retrieving revision 1.125.2.22
retrieving revision 1.125.2.23
diff -u -d -r1.125.2.22 -r1.125.2.23
--- master-settings.c 28 Dec 2006 16:27:46 -0000 1.125.2.22
+++ master-settings.c 9 Jan 2007 20:30:24 -0000 1.125.2.23
@@ -465,12 +465,13 @@
return FALSE;
}
-static void unlink_auth_sockets(const char *path)
+static void unlink_auth_sockets(const char *path, const char *prefix)
{
DIR *dirp;
struct dirent *dp;
struct stat st;
string_t *str;
+ unsigned int prefix_len;
dirp = opendir(path);
if (dirp == NULL) {
@@ -478,11 +479,15 @@
return;
}
+ prefix_len = strlen(prefix);
str = t_str_new(256);
while ((dp = readdir(dirp)) != NULL) {
if (dp->d_name[0] == '.')
continue;
+ if (strncmp(dp->d_name, prefix, prefix_len) != 0)
+ continue;
+
str_truncate(str, 0);
str_printfa(str, "%s/%s", path, dp->d_name);
if (lstat(str_c(str), &st) < 0) {
@@ -735,6 +740,9 @@
i_error("chmod(%s) failed: %m", set->base_dir);
}
+ /* remove auth worker sockets left by unclean exits */
+ unlink_auth_sockets(set->base_dir, "auth-worker.");
+
/* Make sure our permanent state directory exists */
if (mkdir_parents(PKG_STATEDIR, 0750) < 0 && errno != EEXIST) {
i_error("mkdir(%s) failed: %m", PKG_STATEDIR);
@@ -753,7 +761,7 @@
"%s", set->login_dir);
}
- unlink_auth_sockets(set->login_dir);
+ unlink_auth_sockets(set->login_dir, "");
}
#ifdef HAVE_MODULES
More information about the dovecot-cvs
mailing list