- }
- if (S_ISBLK(source_stat.st_mode) || S_ISCHR(source_stat.st_mode) ||
- S_ISSOCK(source_stat.st_mode)) {
- if (mknod(dest, source_stat.st_mode, source_stat.st_rdev) < 0) {
- bb_perror_msg("unable to create `%s'", dest);
- return -1;
- }
- } else if (S_ISFIFO(source_stat.st_mode)) {
- if (mkfifo(dest, source_stat.st_mode) < 0) {
- bb_perror_msg("cannot create fifo `%s'", dest);
- return -1;
- }
- } else if (S_ISLNK(source_stat.st_mode)) {
- char *lpath;
-
- lpath = xreadlink(source);
- if (symlink(lpath, dest) < 0) {
- bb_perror_msg("cannot create symlink `%s'", dest);
- return -1;
- }
- free(lpath);
-
-#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
- if (flags & FILEUTILS_PRESERVE_STATUS)
- if (lchown(dest, source_stat.st_uid, source_stat.st_gid) < 0)
- bb_perror_msg("unable to preserve ownership of `%s'", dest);
-#endif
-
-#ifdef CONFIG_FEATURE_PRESERVE_HARDLINKS
- add_to_ino_dev_hashtable(&source_stat, dest);
-#endif
-
- return 0;