/[imapfilter]/imapfilter/lock.c
ViewVC logotype

Diff of /imapfilter/lock.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by lefcha, Mon Feb 9 22:03:33 2004 UTC revision 1.16 by lefcha, Fri Feb 13 12:17:16 2004 UTC
# Line 33  lockfile_create(void) Line 33  lockfile_create(void)
33    
34          fd = fopen(lockfile, "w");          fd = fopen(lockfile, "w");
35          if (fd == NULL)          if (fd == NULL)
36                  fatal(ERROR_FILE_OPEN, "opening lockfile; %s\n",                  fatal(ERROR_FILEOPEN, "opening lockfile; %s\n",
37                      strerror(errno));                      strerror(errno));
38          fprintf(fd, "%s\n", ultostr(getpid(), 10));          fprintf(fd, "%s\n", ultostr(getpid(), 10));
39          fclose(fd);          fclose(fd);
# Line 78  lockfile_pid(void) Line 78  lockfile_pid(void)
78    
79          n = 0;          n = 0;
80    
81          snprintf(lockf, PATH_MAX, "%s/%s", home, PATHNAME_LOCK_FILE);          snprintf(lockf, PATH_MAX, "%s/%s", home, PATHNAME_LOCK);
82          lockfile = xstrdup(lockf);          lockfile = xstrdup(lockf);
83    
84          if (exists_file(lockfile)) {          if (exists_file(lockfile)) {
85                  fd = fopen(lockfile, "r");                  fd = fopen(lockfile, "r");
86                  if (fd == NULL)                  if (fd == NULL)
87                          fatal(ERROR_FILE_OPEN, "opening lockfile; %s\n",                          fatal(ERROR_FILEOPEN, "opening lockfile; %s\n",
88                              strerror(errno));                              strerror(errno));
89                  if (fgets(line, LINE_MAX - 1, fd)) {                  if (fgets(line, LINE_MAX - 1, fd)) {
90                          errno = 0;                          errno = 0;
# Line 109  lockfile_remove(void) Line 109  lockfile_remove(void)
109    
110          if (unlink(lockfile) && errno != ENOENT) {          if (unlink(lockfile) && errno != ENOENT) {
111                  error("removing lockfile; %s\n", strerror(errno));                  error("removing lockfile; %s\n", strerror(errno));
112                  return ERROR_FILE_OPEN;                  return ERROR_FILEOPEN;
113          }          }
114          return 0;          return 0;
115  }  }

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26