From owner-freebsd-questions Mon Jun 10 07:51:33 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id HAA10330 for questions-outgoing; Mon, 10 Jun 1996 07:51:33 -0700 (PDT) Received: from sycgate.sycomore.fr (sycgate.sycomore.fr [192.134.92.10]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id HAA10324 for ; Mon, 10 Jun 1996 07:51:30 -0700 (PDT) Received: from [192.134.92.34] (unknown.sycomore.fr [192.134.92.34]) by sycgate.sycomore.fr (8.6.3/8.5) with SMTP id QAA04155; Mon, 10 Jun 1996 16:32:31 +0200 X-Sender: berenguier@192.134.92.10 Message-Id: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Mailer: Eudora F1.5.3 Date: Mon, 10 Jun 1996 16:51:49 +0200 To: questions@freebsd.org From: Eric.Berenguier@sycomore.fr (Eric Berenguier) Subject: Bug in truncate function ? Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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 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