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

Diff of /imapfilter/file.c

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

revision 1.57 by lefcha, Thu Jul 31 15:53:19 2003 UTC revision 1.57.2.1 by lefcha, Fri Aug 8 00:28:29 2003 UTC
# Line 1  Line 1 
1  #include <stdio.h>  #include <stdio.h>
2    #include <unistd.h>
3  #include <string.h>  #include <string.h>
4  #include <errno.h>  #include <errno.h>
5  #include <unistd.h>  #include <limits.h>
6  #include <sys/types.h>  #include <sys/types.h>
7  #include <sys/stat.h>  #include <sys/stat.h>
8  #include <fcntl.h>  #include <fcntl.h>
# Line 20  extern char *home; Line 21  extern char *home;
21  int  int
22  create_homedir(void)  create_homedir(void)
23  {  {
24          if (home != NULL)          char hd[PATH_MAX];
                 if (chdir(home))  
                         error("could not change directory; %s\n",  
                             strerror(errno));  
25    
26          if (!exists_dir(PATHNAME_HOME_DIR)) {          snprintf(hd, PATH_MAX, "%s/%s", home, PATHNAME_HOME_DIR);
27                  if (mkdir(PATHNAME_HOME_DIR, S_IRUSR | S_IWUSR | S_IXUSR))  
28                          error("could not create directory %s; %s\n",          if (!exists_dir(hd)) {
29                              PATHNAME_HOME_DIR, strerror(errno));                  if (mkdir(hd, S_IRUSR | S_IWUSR | S_IXUSR))
30                            error("could not create directory %s; %s\n", hd,
31                                strerror(errno));
32          }          }
33  #ifdef CHECK_PERMISSIONS  #ifdef CHECK_PERMISSIONS
34          else {          else {
35                  check_dir_perms(PATHNAME_HOME_DIR, S_IRUSR | S_IWUSR | S_IXUSR);                  check_dir_perms(hd, S_IRUSR | S_IWUSR | S_IXUSR);
36          }          }
37  #endif  #endif
38    

Legend:
Removed from v.1.57  
changed lines
  Added in v.1.57.2.1

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26