Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jun 1996 16:51:49 +0200
From:      Eric.Berenguier@sycomore.fr (Eric Berenguier)
To:        questions@freebsd.org
Subject:   Bug in truncate function ?
Message-ID:  <v01530503ade1e4a001d7@[192.134.92.34]>

next in thread | raw e-mail | index | archive | help
Hello,

        I'm using FreeBSD release 2.1.0, and it seems the ftruncate
function doesn't work:

here is a small exemple that doesn't work as i think it should:

-- Exemple -----------------------------------------------------------
#include <fcntl.h>

main() {
  int fd;
  fd = open("/tmp/pp01234", O_RDWR | O_CREAT , 0600);
  if (ftruncate(fd,0)<0) {
    perror("truncate");
  }
}
----------------------------------------------------------------------

this program ouputs:
truncate: invalid argument


i've tried both truncate and ftruncate with various values as argument
and i've never managed to have the function succeed.

Tripwire doesn't work too, because it uses ftruncate
(it says: truncate(): invalid argument, and dies)

Is it a bug ? or can you tell me where i'm wrong ?

Thanks in advance,




--
Eric Berenguier

                    SYCOMORE
31, place des Corolles - 92098 PARIS LA DEFENSE
             http://www.sycomore.fr





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?v01530503ade1e4a001d7>