const char *maildir_shared_index_file() { static char *filenamep=NULL; if (filenamep == NULL) { const char *p=getenv("SQWEBMAIL_SHAREDINDEXFILE"); if (!p || !*p) p=SHAREDINDEXFILE; if (p && *p) { const char *q=auth_getoptionenv("sharedgroup"); if (!q) q=""; filenamep=malloc(strlen(p)+strlen(q)+1); if (!filenamep) enomem(); strcat(strcpy(filenamep, p), q); } } if (filenamep && verify_shared_index_file) { struct stat stat_buf; if (stat(filenamep, &stat_buf)) { fprintf(stderr, "ERR: "); perror(filenamep); } } return filenamep; }
const char *maildir_shared_index_file() { static char *filenamep=NULL; if (filenamep == NULL) { const char *p=getenv("IMAP_SHAREDINDEXFILE"); if (p && *p) { const char *q=auth_getoptionenv("sharedgroup"); if (!q) q=""; filenamep=malloc(strlen(p)+strlen(q)+1); if (!filenamep) write_error_exit(0); strcat(strcpy(filenamep, p), q); } } if (filenamep && !shared_index_err_reported) /* Bitch just once */ { struct stat stat_buf; shared_index_err_reported=1; if (stat(filenamep, &stat_buf)) { fprintf(stderr, "ERR: "); perror(filenamep); } } return filenamep; }