X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fannosbr.c;h=87e9580b423f896d42264a431816174c4b7161e0;hb=93f22073ff22b277206b0481c1f8f076aee1656d;hp=e8ef50ae209afa87e36002fbdd3879be3fba38f4;hpb=322f6f0518f2fca892733dea85d87c33fcb65e83;p=mmh diff --git a/uip/annosbr.c b/uip/annosbr.c index e8ef50a..87e9580 100644 --- a/uip/annosbr.c +++ b/uip/annosbr.c @@ -2,8 +2,6 @@ /* * annosbr.c -- prepend annotation to messages * - * $Id$ - * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. @@ -179,20 +177,15 @@ annosbr (int fd, char *file, char *comp, char *text, int inplace, int datesw, in FILE *tmp; int c; /* current character */ int count; /* header field (annotation) counter */ - char *field; /* buffer for header field */ - int field_size; /* size of field buffer */ - FILE *fp; /* file pointer made from locked file descriptor */ + char *field = NULL; /* buffer for header field */ + int field_size = 0; /* size of field buffer */ + FILE *fp = NULL; /* file pointer made from locked file descriptor */ int length; /* length of field name */ int n; /* number of bytes written */ mode = fstat (fd, &st) != NOTOK ? (st.st_mode & 0777) : m_gmprot (); - strncpy (tmpfil, m_scratch (file, "annotate"), sizeof(tmpfil)); - - if ((tmp = fopen (tmpfil, "w")) == NULL) { - admonish (tmpfil, "unable to create"); - return 1; - } + strncpy (tmpfil, m_mktemp2(file, "annotate", NULL, &tmp), sizeof(tmpfil)); chmod (tmpfil, mode); /*