Xref: utzoo comp.unix.xenix:1270 comp.sys.att:1969 Newsgroups: comp.unix.xenix,comp.sys.att Path: utzoo!lsuc!dave From: dave@lsuc.uucp (David Sherman) Subject: Re: mailx and big files Reply-To: dave@lsuc.UUCP (David Sherman) Date: Mon, 4-Jan-88 14:06:20 EST Summary: >32767 can be negative Message-ID: <1988Jan4.140623.19127@lsuc.uucp> References: <2433@dasys1.UUCP> Organization: Law Society of Upper Canada, Toronto In article <2433@dasys1.UUCP> samperi@dasys1.UUCP (Dominick Samperi) writes: >When I use mailx to send a large text file (about 50K or more) via >'mailx user < file', I get error messages of the form "can't append >to /usr/mail/user" and "can't write to dead.letter", yet it turns out >that the contents of the file WAS appended to /usr/mail/user, and >the contents were also written to dead.letter! Furthermore, there was >no corruption in either file (/usr/mail/user or dead.letter). I'm using >an AT compatible, running System V/AT. Any ideas out there? Sure. You're using a 16-bit machine, and the value for the number of bytes written is stored in a regular (short) "int" variable. Once this tops 32767, it goes negative. The code which tests for success of the write assumes that "n<0" means failure (normally -1 is returned on failure of a system call), so it tells you the write failed when in fact it worked fine. Solution, if you have source, is of course to ensure that the variable used to store the number of bytes written is a long int. David Sherman The Law Society of Upper Canada Toronto -- { uunet!mnetor pyramid!utai decvax!utcsri ihnp4!utzoo } !lsuc!dave Pronounce it ell-ess-you-see, please...