- case 0: /* Child. */
- execl (MVDIR, "mvdir", from, to, (char *) 0);
- error (255, errno, "cannot run `%s'", MVDIR);
-
- default: /* Parent. */
- while (wait (&status) != pid)
- /* Do nothing. */ ;
-
- errno = 0; /* mvdir printed the system error message. */
- if (status)
- return -1;
- }
- }
- else
- {
- if (link (from, to))
- return -1;
- if (unlink (from) && errno != ENOENT)
- {
- unlink (to);
- return -1;
- }
- }
- return 0;