let pilerget syslog its error messages

This commit is contained in:
SJ 2012-10-23 10:12:56 +02:00
parent f9bcdb2047
commit ff30debbf4
3 changed files with 6 additions and 5 deletions

View File

@ -142,13 +142,13 @@ int retrieve_file_from_archive(char *filename, int mode, char **buffer, FILE *de
fd = open(filename, O_RDONLY); fd = open(filename, O_RDONLY);
if(fd == -1){ if(fd == -1){
printf("error reading file: %s\n", filename); syslog(LOG_PRIORITY, "%s: cannot open()", filename);
return 1; return 1;
} }
if(fstat(fd, &st)){ if(fstat(fd, &st)){
printf("cannot fstat() on %s\n", filename); syslog(LOG_PRIORITY, "%s: cannot fstat()", filename);
close(fd); close(fd);
return 1; return 1;
} }
@ -172,7 +172,7 @@ int retrieve_file_from_archive(char *filename, int mode, char **buffer, FILE *de
while((n = read(fd, inbuf, sizeof(inbuf)))){ while((n = read(fd, inbuf, sizeof(inbuf)))){
if(!EVP_DecryptUpdate(&ctx, s+tlen, &olen, inbuf, n)){ if(!EVP_DecryptUpdate(&ctx, s+tlen, &olen, inbuf, n)){
printf("EVP_DecryptUpdate()\n"); syslog(LOG_PRIORITY, "%s: EVP_DecryptUpdate()", filename);
goto CLEANUP; goto CLEANUP;
} }
@ -181,7 +181,7 @@ int retrieve_file_from_archive(char *filename, int mode, char **buffer, FILE *de
if(EVP_DecryptFinal(&ctx, s + tlen, &olen) != 1){ if(EVP_DecryptFinal(&ctx, s + tlen, &olen) != 1){
printf("EVP_DecryptFinal()\n"); syslog(LOG_PRIORITY, "%s: EVP_DecryptFinal()", filename);
goto CLEANUP; goto CLEANUP;
} }

View File

@ -13,7 +13,7 @@
#define VERSION "0.1.21" #define VERSION "0.1.21"
#define BUILD 716 #define BUILD 717
#define HOSTID "mailarchiver" #define HOSTID "mailarchiver"

View File

@ -27,6 +27,7 @@ int main(int argc, char **argv){
exit(1); exit(1);
} }
(void) openlog("pilerget", LOG_PID, LOG_MAIL);
cfg = read_config(CONFIG_FILE); cfg = read_config(CONFIG_FILE);