Back to index

glibc  2.9
rename.c File Reference
#include <stdio.h>
#include <hurd.h>

Go to the source code of this file.


int rename (char *old, const char *new) const

Function Documentation

int rename ( char *  old,
const char *  new 
) const

Definition at line 24 of file rename.c.

  error_t err;
  file_t olddir, newdir;
  const char *oldname, *newname;

  olddir = __directory_name_split (old, (char **) &oldname);
  if (olddir == MACH_PORT_NULL)
    return -1;
  newdir = __directory_name_split (new, (char **) &newname);
  if (newdir == MACH_PORT_NULL)
       __mach_port_deallocate (__mach_task_self (), olddir);
      return -1;

  err = __dir_rename (olddir, oldname, newdir, newname, 0);
  __mach_port_deallocate (__mach_task_self (), olddir);
  __mach_port_deallocate (__mach_task_self (), newdir);
  if (err)
    return __hurd_fail (err);
  return 0;

Here is the call graph for this function: