- {
- if ((from_stats.st_dev == to_stats.st_dev)
- && (from_stats.st_ino == to_stats.st_ino))
- /* `from' and `to' designate the same file on that filesystem. */
- return 0;
-
- if (unlink (to) && errno != ENOENT)
- return -1;
- }
-
- if (S_ISDIR (from_stats.st_mode))
- {
- /* Need a setuid root process to link and unlink directories. */
- pid = fork ();
- switch (pid)
- {
- case -1: /* Error. */
- error (1, errno, "cannot fork");