ソースを参照

Exit upon failure to open attachment.

Error out properly if we cannot open a file to attach.
tags/fmail-0.2.1^2
コミット
33b9b1293e
1個のファイルの変更6行の追加2行の削除
  1. +6
    -2
      src/fmail.c

+ 6
- 2
src/fmail.c ファイルの表示

@@ -141,7 +141,9 @@ check_7bit_encoding(const char *filename)
int c, ok = 1;
unsigned n;

f = fopen(filename, "r");
if ( ! (f = fopen(filename, "r")) )
return 0; /* We'll error out later. */

while ( ! feof(f) && ! ok ) {
c = fgetc(f);

@@ -609,7 +611,9 @@ process_attachment(const char *filename, magic_t ctx, FILE *out)
fprintf(out, "Content-Transfer-Encoding: %s\r\n", encoding_names[encoding]);
fprintf(out, "Content-Disposition: attachment; filename=%s\r\n\r\n", get_basename(filename));

f = fopen(filename, "r");
if ( ! (f = fopen(filename, "r")) )
err(EXIT_FAILURE, "cannot open attachment '%s'", filename);

encoding_funcs[encoding](f, out);
fclose(f);



読み込み中…
キャンセル
保存