X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/1d08c1e0c0de0d321883ece1c36bce851fe893c7..4a56a28ac:/uip/rcvtty.c diff --git a/uip/rcvtty.c b/uip/rcvtty.c index ab674f0d..6991829e 100644 --- a/uip/rcvtty.c +++ b/uip/rcvtty.c @@ -1,6 +1,4 @@ - -/* - * rcvtty.c -- a rcvmail program (a lot like rcvalert) handling IPC ttys +/* rcvtty.c -- a rcvmail program (a lot like rcvalert) handling IPC ttys * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for @@ -19,6 +17,8 @@ #include #include #include +#include +#include "../sbr/m_mktemp.h" #include #ifdef HAVE_GETUTXENT @@ -82,7 +82,7 @@ main (int argc, char **argv) char **argp, **arguments, *vec[MAXARGS]; struct utmpx *utp; - if (nmh_init(argv[0], 1)) { return 1; } + if (nmh_init(argv[0], 2)) { return 1; } mts_init (); arguments = getarguments (invo_name, argc, argv, 1); @@ -189,7 +189,7 @@ message_fd (char **vec) struct stat st; if ((tfile = m_mktemp2(NULL, invo_name, &fd, NULL)) == NULL) { - advise(NULL, "unable to create temporary file in %s", get_temp_dir()); + inform("unable to create temporary file in %s", get_temp_dir()); return NOTOK; } (void) m_unlink(tfile); /* Use fd, no longer need the file name. */ @@ -198,7 +198,8 @@ message_fd (char **vec) /* fork error */ close (fd); return header_fd (); - } else if (child_id) { + } + if (child_id) { /* parent process */ if (!setjmp (myctx)) { SIGNAL (SIGALRM, alrmser); @@ -218,7 +219,7 @@ message_fd (char **vec) pidwait(child_id, OK); alarm (0); - if (fstat (fd, &st) != NOTOK && st.st_size > (off_t) 0) + if (fstat (fd, &st) != NOTOK && st.st_size > 0) return fd; } else { /* @@ -254,7 +255,7 @@ header_fd (void) charstring_t scanl = NULL; if ((tfile = m_mktemp2(NULL, invo_name, &fd, NULL)) == NULL) { - advise(NULL, "unable to create temporary file in %s", get_temp_dir()); + inform("unable to create temporary file in %s", get_temp_dir()); return NOTOK; } (void) m_unlink(tfile); /* Use fd, no longer need the file name. */ @@ -314,7 +315,7 @@ alert (char *tty, int md) return; } - lseek (md, (off_t) 0, SEEK_SET); + lseek(md, 0, SEEK_SET); while ((i = read (md, buffer, sizeof(buffer))) > 0) if (write (td, buffer, i) != i)