[dovecot-cvs] dovecot/src/lib unlink-lockfiles.c,1.4,1.5
unlink-lockfiles.h,1.2,1.3
cras at procontrol.fi
cras at procontrol.fi
Thu Jul 3 05:01:12 EEST 2003
Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv14501
Modified Files:
unlink-lockfiles.c unlink-lockfiles.h
Log Message:
some more cleanups
Index: unlink-lockfiles.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/unlink-lockfiles.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- unlink-lockfiles.c 3 Jul 2003 00:58:42 -0000 1.4
+++ unlink-lockfiles.c 3 Jul 2003 01:01:10 -0000 1.5
@@ -44,12 +44,8 @@
/* check for any invalid access files */
dirp = opendir(dir);
- if (dirp == NULL) {
- if (errno == ENOENT)
- return 0;
- i_error("opendir(%s) failed: %m", dir);
+ if (dirp == NULL)
return -1;
- }
pidlen = pidprefix == NULL ? 0 : strlen(pidprefix);
otherlen = otherprefix == NULL ? 0 : strlen(otherprefix);
@@ -69,7 +65,7 @@
if (str_path(path, sizeof(path), dir, fname) == 0) {
if (unlink(path) < 0 && errno != ENOENT) {
i_error("unlink(%s) failed: %m", path);
- ret = -1;
+ ret = 0;
}
}
} else if (otherprefix != NULL &&
@@ -80,15 +76,13 @@
st.st_ctime < other_min_time)
if (unlink(path) < 0 && errno != ENOENT) {
i_error("unlink(%s) failed: %m", path);
- ret = -1;
+ ret = 0;
}
}
}
- if (closedir(dirp) < 0) {
+ if (closedir(dirp) < 0)
i_error("closedir(%s) failed: %m", dir);
- ret = -1;
- }
return ret;
}
Index: unlink-lockfiles.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib/unlink-lockfiles.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- unlink-lockfiles.h 3 Jul 2003 00:58:42 -0000 1.2
+++ unlink-lockfiles.h 3 Jul 2003 01:01:10 -0000 1.3
@@ -4,7 +4,10 @@
/* Delete stale lock files. Filenames beginning with pidprefix<PID> are
deleted immediately if PID doesn't exist. Filenames beginning with
otherprefix are deleted if their mtime and ctime is older than
- other_min_time. */
+ other_min_time.
+
+ Returns 1 if everything was successful, 0 if some of the files
+ couldn't be deleted, -1 if directory couldn't be opened at all. */
int unlink_lockfiles(const char *dir, const char *pidprefix,
const char *otherprefix, time_t other_min_time);
More information about the dovecot-cvs
mailing list