Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Mar 1996 11:06:59 -0600
From:      admin <admin@dmzpc.bridge.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/1092: trouble with ftruncate(2)
Message-ID:  <199603201706.LAA08177@dmzpc.bridge.com>
Resent-Message-ID: <199603202310.PAA13287@freefall.freebsd.org>

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

>Number:         1092
>Category:       kern
>Synopsis:       ftruncate(2) returns EINVAL
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 20 15:10:02 PST 1996
>Last-Modified:
>Originator:     khardy@acm.org
>Organization:
>Release:        FreeBSD 2.1-STABLE i386
>Environment:

	

>Description:

	
	The ftruncate(2) system call always seems to return EINVAL,
	at least in all the ways I've tried it.

>How-To-Repeat:

	

	/* This pgm succeeds on FreeBSD 2.0, BSDI 1.1, and SunOS 4.1.3C, but
	 * fails on FreeBSD 2.1
	 */
	#include <stdio.h>
	#include <fcntl.h>

	main (int argc, char **argv)
	{
		int fd ;
		if (argc != 2) {
			fprintf (stderr, "usage: %s filename\n", argv[0]) ;
			return (-1) ;
		}
		if ( (fd = open (argv[1], O_CREAT|O_TRUNC|O_RDWR, 0600) ) < 0) {
			perror (argv[1]) ;
			return (-1) ;
		}
		if (ftruncate (fd, 0L) ) {
			perror ("truncate(fd,0)") ;
			return (-1) ;
		}
		printf ("OK\n") ;
		return 0 ;
	}


>Fix:
	
	

>Audit-Trail:
>Unformatted:



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