X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/337b4e616e8f53ba06285b1645e1df9918ed5c16..8a5b32e396d5bbf89b419ec442f33f6962d58a17:/sbr/mime_type.c diff --git a/sbr/mime_type.c b/sbr/mime_type.c index 06a6156d..b235bc7c 100644 --- a/sbr/mime_type.c +++ b/sbr/mime_type.c @@ -37,14 +37,15 @@ mime_type(const char *file_name) { if ((mimeencoding = get_file_info(MIMEENCODINGPROC, file_name))) { content_type = concat(mimetype, "; charset=", mimeencoding, NULL); + free (mimetype); } else { - content_type = strdup(mimetype); + content_type = mimetype; } } else { - content_type = strdup(mimetype); + content_type = mimetype; } #else /* MIMEENCODINGPROC */ - content_type = strdup(mimetype); + content_type = mimetype; #endif /* MIMEENCODINGPROC */ } #endif /* MIMETYPEPROC */ @@ -86,7 +87,7 @@ mime_type(const char *file_name) { int binary = 0, c; if (!(fp = fopen(file_name, "r"))) { - advise (NULL, "unable to access file \"%s\"", file_name); + inform("unable to access file \"%s\"", file_name); return NULL; } @@ -120,12 +121,11 @@ get_file_info(const char *proc, const char *file_name) { if ((cp = strchr(file_name, '\''))) { /* file_name contains a single quote. */ if (strchr(file_name, '"')) { - advise(NULL, "filenames containing both single and double quotes " + inform("filenames containing both single and double quotes " "are unsupported for attachment"); return NULL; - } else { - quotec = "\""; } + quotec = "\""; } if ((cmd = concat(proc, " ", quotec, file_name, quotec, NULL))) { @@ -162,12 +162,12 @@ get_file_info(const char *proc, const char *file_name) { (void) pclose(fp); } else { - advise(NULL, "no output from %s", cmd); + inform("no output from %s", cmd); } free(cmd); } else { - advise(NULL, "concat with \"%s\" failed, out of memory?", proc); + inform("concat with \"%s\" failed, out of memory?", proc); } return cp ? strdup(cp) : NULL;