diff --git a/dgl-common.c b/dgl-common.c index a7f8137..0e95e64 100644 --- a/dgl-common.c +++ b/dgl-common.c @@ -157,14 +157,14 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me) char buf[1024]; size_t bytes; /* FIXME: use nethack-themed error messages here, as per write_canned_rcfile() */ - if (!(newfile = fopen (p2, "w"))) return 1; - if (!(cannedf = fopen (p1, "r"))) return 1; + if (!(newfile = fopen (p2, "w"))) break; + if (!(cannedf = fopen (p1, "r"))) break; while ((bytes = fread (buf, 1, 1024, cannedf)) > 0) { if (fwrite (buf, 1, bytes, newfile) != bytes) { if (ferror (newfile)) { fclose (cannedf); fclose (newfile); - return 1; + break; } } }