X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=changer-src%2Fchg-scsi-chio.c;h=3489c67ef4730d35357495e3bbc3768e227d48da;hb=2627875b7d18858bc1f9f7652811e4d8c15a23eb;hp=b5b76bdfee84c59a650aab7f4a94f5e1ccd12d07;hpb=fb2bd066c2f8b34addafe48d62550e3033a59431;p=debian%2Famanda diff --git a/changer-src/chg-scsi-chio.c b/changer-src/chg-scsi-chio.c index b5b76bd..3489c67 100644 --- a/changer-src/chg-scsi-chio.c +++ b/changer-src/chg-scsi-chio.c @@ -634,11 +634,14 @@ clean_tape( char * usagetime) { int counter; + char *mailer; if (cleancart == -1 ){ return; } + mailer = getconf_str(CNF_MAILER); + /* Now we should increment the counter */ if (cnt_file != NULL){ counter = get_current_slot(cnt_file); @@ -648,29 +651,29 @@ clean_tape( char *mail_cmd; FILE *mailf; int mail_pipe_opened = 1; -#ifdef MAILER - if(getconf_seen(CNF_MAILTO) && strlen(getconf_str(CNF_MAILTO)) > 0 && - validate_mailto(getconf_str(CNF_MAILTO))) { - mail_cmd = vstralloc(MAILER, - " -s", " \"", _("AMANDA PROBLEM: PLEASE FIX"), "\"", - " ", getconf_str(CNF_MAILTO), - NULL); - if((mailf = popen(mail_cmd, "w")) == NULL){ - g_printf(_("Mail failed\n")); - error(_("could not open pipe to \"%s\": %s"), - mail_cmd, strerror(errno)); - /*NOTREACHED*/ - } + if (mailer && *mailer != '\0') { + if (getconf_seen(CNF_MAILTO) && strlen(getconf_str(CNF_MAILTO)) > 0 && + validate_mailto(getconf_str(CNF_MAILTO))) { + mail_cmd = vstralloc(mailer, + " -s", " \"", _("AMANDA PROBLEM: PLEASE FIX"), "\"", + " ", getconf_str(CNF_MAILTO), + NULL); + if ((mailf = popen(mail_cmd, "w")) == NULL) { + g_printf(_("Mail failed\n")); + error(_("could not open pipe to \"%s\": %s"), + mail_cmd, strerror(errno)); + /*NOTREACHED*/ + } + } else { + mail_pipe_opened = 0; + mailf = stderr; + g_fprintf(mailf, _("\nNo mail recipient specified, output redirected to stderr")); + } } else { - mail_pipe_opened = 0; - mailf = stderr; - g_fprintf(mailf, _("\nNo mail recipient specified, output redirected to stderr")); + mail_pipe_opened = 0; + mailf = stderr; + g_fprintf(mailf, _("\nNo mailer specified; output redirected to stderr")); } -#else - mail_pipe_opened = 0; - mailf = stderr; - g_fprintf(mailf, _("\nNo mailer specified; output redirected to stderr")); -#endif g_fprintf(mailf, _("\nThe usage count of your cleaning tape in slot %d"), cleancart); g_fprintf(mailf,_("\nis more than %d. (cleanmax)"),maxclean); @@ -749,7 +752,14 @@ main( parse_args(argc,argv,&com); changer = alloc(SIZEOF(changer_t)); - config_init(CONFIG_INIT_USE_CWD | CONFIG_INIT_FATAL, NULL); + config_init(CONFIG_INIT_USE_CWD, NULL); + + if (config_errors(NULL) >= CFGERR_WARNINGS) { + config_print_errors(); + if (config_errors(NULL) >= CFGERR_ERRORS) { + g_critical(_("errors processing config file")); + } + } changer_dev = getconf_str(CNF_CHANGERDEV); changer_file = getconf_str(CNF_CHANGERFILE);