X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fprompter.c;h=6f97a8806a2a01a6fa2860285d02457add14375d;hb=676aafb5cca9531170843b28fe4e3ba12c322c50;hp=bc194ffec3f508dc93c1cfc026176aeca54676ab;hpb=6c42153ad9362cc676ea66563bf400d7511b3b68;p=mmh diff --git a/uip/prompter.c b/uip/prompter.c index bc194ff..6f97a88 100644 --- a/uip/prompter.c +++ b/uip/prompter.c @@ -64,7 +64,6 @@ static struct swit switches[] = { { NULL, 0 } }; -extern int errno; #ifdef HAVE_TERMIOS_H static struct termios tio; @@ -109,6 +108,7 @@ main (int argc, char **argv) char buffer[BUFSIZ], tmpfil[BUFSIZ]; char **arguments, **argp; FILE *in, *out; + char *tfile = NULL; #ifdef LOCALE setlocale(LC_ALL, ""); @@ -186,10 +186,10 @@ main (int argc, char **argv) if ((in = fopen (drft, "r")) == NULL) adios (drft, "unable to open"); - strncpy (tmpfil, m_tmpfil (invo_name), sizeof(tmpfil)); - if ((out = fopen (tmpfil, "w")) == NULL) - adios (tmpfil, "unable to create"); + tfile = m_mktemp2(NULL, invo_name, NULL, &out); + if (tfile == NULL) adios("prompter", "unable to create temporary file"); chmod (tmpfil, 0600); + strncpy (tmpfil, tfile, sizeof(tmpfil)); /* * Are we changing the kill or erase character? @@ -401,7 +401,8 @@ no_body: unlink (tmpfil); context_save (); /* save the context file */ - return done (0); + done (0); + return 1; }