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

Diff of /imapfilter/file.c

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

revision 1.62 by lefcha, Tue Feb 10 22:21:08 2004 UTC revision 1.63 by lefcha, Fri Feb 13 12:17:15 2004 UTC
# Line 13  Line 13 
13    
14    
15  extern char *home;  extern char *home;
16  extern opts_t opts;  extern options_t opts;
17    
18    
19  /*  /*
# Line 24  create_homedir(void) Line 24  create_homedir(void)
24  {  {
25          char hd[PATH_MAX];          char hd[PATH_MAX];
26    
27          snprintf(hd, PATH_MAX, "%s/%s", home, PATHNAME_HOME_DIR);          snprintf(hd, PATH_MAX, "%s/%s", home, PATHNAME_HOME);
28    
29          if (!exists_dir(hd)) {          if (!exists_dir(hd)) {
30                  if (mkdir(hd, S_IRUSR | S_IWUSR | S_IXUSR))                  if (mkdir(hd, S_IRUSR | S_IWUSR | S_IXUSR))
# Line 51  exists_file(char *fname) Line 51  exists_file(char *fname)
51          stat(fname, &fs);          stat(fname, &fs);
52          if (!S_ISREG(fs.st_mode)) {          if (!S_ISREG(fs.st_mode)) {
53                  error("file %s not a regular file\n", fname);                  error("file %s not a regular file\n", fname);
54                  return ERROR_FILE_OPEN;                  return ERROR_FILEOPEN;
55          }          }
56          return 1;          return 1;
57  }  }
# Line 71  exists_dir(char *dname) Line 71  exists_dir(char *dname)
71          stat(dname, &ds);          stat(dname, &ds);
72          if (!S_ISDIR(ds.st_mode)) {          if (!S_ISDIR(ds.st_mode)) {
73                  error("file %s not a directory\n", dname);                  error("file %s not a directory\n", dname);
74                  return ERROR_FILE_OPEN;                  return ERROR_FILEOPEN;
75          }          }
76          return 1;          return 1;
77  }  }
# Line 92  create_file(char *fname, mode_t mode) Line 92  create_file(char *fname, mode_t mode)
92                  if (fd == -1) {                  if (fd == -1) {
93                          error("could not create file %s; %s\n", fname,                          error("could not create file %s; %s\n", fname,
94                              strerror(errno));                              strerror(errno));
95                          return ERROR_FILE_OPEN;                          return ERROR_FILEOPEN;
96                  }                  }
97                  close(fd);                  close(fd);
98          }          }

Legend:
Removed from v.1.62  
changed lines
  Added in v.1.63

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26