Date: Sat, 5 Sep 1998 01:26:07 -0300 (EST) From: Joao Carlos Mendes Luis <jonny@jonny.eng.br> To: wes@softweyr.com (Wes Peters) Cc: lva@dds.nl, freebsd-isp@FreeBSD.ORG, freebsd-security@FreeBSD.ORG Subject: Re: small LDA c program requested Message-ID: <199809050426.BAA20989@roma.coe.ufrj.br> In-Reply-To: <35F1BBD9.7E2A42F@softweyr.com> from Wes Peters at "Sep 5, 98 04:31:53 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
#define quoting(Wes Peters) // /* // * Create the file and prepare to write. // */ // snprintf(mailbox, PATH_MAX, "/var/mail/%s/%s", domain, user); // if ((fd = open(mailbox, O_WRONLY | O_APPEND | O_CREAT, 0600)) < 0) // { // abort("Cannot open user mailbox \"%s\" for appending.\n", mailbox); // } // // /* // * OK, copy stdin until exhausted. // */ // while ((nbytes = read(STDIN_FILENO, buffer, BUFSIZ)) > 0) // { // if (write(fd, buffer, nbytes) != nbytes) // { // abort("Error writing mailbox \"%s\".\n", mailbox); // } // } // // close(fd); // return 0; Shouldn't you lock the file ? O_APPEND is only good for atomic writes, IIRC. Jonny -- Joao Carlos Mendes Luis M.Sc. Student jonny@jonny.eng.br Universidade Federal do Rio de Janeiro "There are two major products that come out of Berkeley: LSD and Unix. We don't believe this to be a coincidence." -- Jeremy S. Anderson To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809050426.BAA20989>