[dovecot-cvs] dovecot/src/master master-settings.c,1.151,1.152
tss at dovecot.org
tss at dovecot.org
Tue Jan 9 20:30:28 UTC 2007
Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv17888
Modified Files:
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.151
retrieving revision 1.152
diff -u -d -r1.151 -r1.152
--- master-settings.c 28 Dec 2006 16:28:33 -0000 1.151
+++ master-settings.c 9 Jan 2007 20:30:25 -0000 1.152
@@ -466,12 +466,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) {
@@ -479,11 +480,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) {
@@ -736,6 +741,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);
@@ -754,7 +762,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