Back to index

glibc  2.9
truncate.c File Reference
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>
#include <hurd.h>

Go to the source code of this file.


int __truncate (char *file_name, off_t length) const

Function Documentation

int __truncate ( char *  file_name,
off_t  length 
) const

Definition at line 27 of file truncate.c.

  error_t err;
  file_t file = __file_name_lookup (file_name, O_WRITE, 0);

  if (file == MACH_PORT_NULL)
    return -1;

  err = __file_set_size (file, length);
  __mach_port_deallocate (__mach_task_self (), file);

  if (err)
    return __hurd_fail (err);
  return 0;

Here is the call graph for this function: