wrapper.c: add and use fopen_or_warn()
[gitweb.git] / builtin / am.c
index a95dd8b4e6c793d9e51658e2ccbe535cf5a5af45..f5dac7783e551c1dc7d3a23a39b5e8bdd8cbe0f0 100644 (file)
@@ -1275,12 +1275,8 @@ static int parse_mail(struct am_state *state, const char *mail)
                die("BUG: invalid value for state->scissors");
        }
 
-       mi.input = fopen(mail, "r");
-       if (!mi.input)
-               die("could not open input");
-       mi.output = fopen(am_path(state, "info"), "w");
-       if (!mi.output)
-               die("could not open output 'info'");
+       mi.input = xfopen(mail, "r");
+       mi.output = xfopen(am_path(state, "info"), "w");
        if (mailinfo(&mi, am_path(state, "msg"), am_path(state, "patch")))
                die("could not parse patch");