check return value of m_getfld2 befor using the field
[mmh] / uip / distsbr.c
index 494c298..058875c 100644 (file)
@@ -77,7 +77,7 @@ distout(char *drft, char *msgnam, char *backup)
 
                case LENERR2:
                case FMTERR2:
-               case ERR2:
+               case IOERR2:
                        advise(NULL, "Please re-edit draft and fix that header.");
 leave_bad: ;
                        fclose(ifp);
@@ -182,10 +182,10 @@ ready_msg(char *msgnam)
                                return NOTOK;
                        }
                        unlink(tmpfil);
-                       fprintf(ofp, "\n%s", f.value);
+                       fputs("\n", ofp);
                        while (state == BODY2) {
-                               state = m_getfld2(state, &f, ifp);
                                fputs(f.value, ofp);
+                               state = m_getfld2(state, &f, ifp);
                        }
                        /* FALL */
 
@@ -194,7 +194,7 @@ ready_msg(char *msgnam)
 
                case LENERR2:
                case FMTERR2:
-               case ERR2:
+               case IOERR2:
                        advise(NULL, "format error in message %s", msgnam);
                        return NOTOK;