in reply to Re: Truncate a mailbox in place
in thread Truncate a mailbox in place

It looks like it should, but if i add the line
(truncate (MAILBOX, 0)) or print "ACK!: truncate didn't work : $!\n";
I get : ACK!: truncate didn't work : Permission denied
Permissions on /var/spool/mail are
drwxrwxr-x   2 root     mail         1024 Jan 12 22:43 /var/spool/mail/
and permissions on the mailbox file in that directory are 0660, so it looks like truncate is trying to unlink the file and recreate it (or something - it does the same with a non-zero LENGTH).

setantae@eidosnet.co.uk|setantae|www.setantae.uklinux.net

Replies are listed 'Best First'.
(tye)Re: Truncate a mailbox in place
by tye (Sage) on Jan 13, 2001 at 03:57 UTC

    You can't truncate a mailbox that you have open to only read from. Use "+<" isntead of "<" as your open mode if you want to use the MAILBOX handle to truncate the file.

            - tye (but my friends call me "Tye")