#include "defines.h"
#ifdef WITH_SELINUX
#include <selinux/selinux.h>
-#endif
+#endif /* WITH_SELINUX */
static /*@null@*/const char *src_orig;
static /*@null@*/const char *dst_orig;
static int copy_symlink (const char *src, const char *dst,
const struct stat *statp, const struct timeval mt[],
long int uid, long int gid);
-#endif
+#endif /* S_IFLNK */
static int copy_hardlink (const char *src, const char *dst,
struct link_name *lp);
static int copy_special (const char *dst,
}
return 0;
}
-#endif
+#endif /* WITH_SELINUX */
/*
* remove_link - delete a link from the linked list
#ifdef WITH_SELINUX
/* Reset SELinux to create files with default contexts */
setfscreatecon (NULL);
-#endif
+#endif /* WITH_SELINUX */
/* FIXME: with the call to remove_link, we could also check that
* no links remain in links.
#ifdef HAVE_STRUCT_STAT_ST_ATIM
mt[0].tv_sec = sb.st_atim.tv_sec;
mt[0].tv_usec = sb.st_atim.tv_nsec / 1000;
-#else
+#else /* !HAVE_STRUCT_STAT_ST_ATIM */
mt[0].tv_sec = sb.st_atime;
-#ifdef HAVE_STRUCT_STAT_ST_ATIMENSEC
+# ifdef HAVE_STRUCT_STAT_ST_ATIMENSEC
mt[0].tv_usec = sb.st_atimensec / 1000;
-#else
+# else /* !HAVE_STRUCT_STAT_ST_ATIMENSEC */
mt[0].tv_usec = 0;
-#endif
-#endif
+# endif /* !HAVE_STRUCT_STAT_ST_ATIMENSEC */
+#endif /* !HAVE_STRUCT_STAT_ST_ATIM */
#ifdef HAVE_STRUCT_STAT_ST_MTIM
mt[1].tv_sec = sb.st_mtim.tv_sec;
mt[1].tv_usec = sb.st_mtim.tv_nsec / 1000;
-#else
+#else /* !HAVE_STRUCT_STAT_ST_MTIM */
mt[1].tv_sec = sb.st_mtime;
-#ifdef HAVE_STRUCT_STAT_ST_MTIMENSEC
+# ifdef HAVE_STRUCT_STAT_ST_MTIMENSEC
mt[1].tv_usec = sb.st_mtimensec / 1000;
-#else
+# else /* !HAVE_STRUCT_STAT_ST_MTIMENSEC */
mt[1].tv_usec = 0;
-#endif
-#endif
+# endif /* !HAVE_STRUCT_STAT_ST_MTIMENSEC */
+#endif /* !HAVE_STRUCT_STAT_ST_MTIM */
if (S_ISDIR (sb.st_mode)) {
err = copy_dir (src, dst, &sb, mt, uid, gid);
else if (S_ISLNK (sb.st_mode)) {
err = copy_symlink (src, dst, &sb, mt, uid, gid);
}
-#endif
+#endif /* S_IFLNK */
/*
* See if this is a previously copied link
#ifdef WITH_SELINUX
selinux_file_context (dst);
-#endif
+#endif /* WITH_SELINUX */
if ( (mkdir (dst, statp->st_mode) != 0)
|| (chown (dst,
(uid == - 1) ? statp->st_uid : (uid_t) uid,
#ifdef WITH_SELINUX
selinux_file_context (dst);
-#endif
+#endif /* WITH_SELINUX */
if ( (symlink (oldlink, dst) != 0)
|| (lchown (dst,
(uid == -1) ? statp->st_uid : (uid_t) uid,
* - not implemented
*/
lutimes (dst, mt);
-#endif
+#endif /* HAVE_LUTIMES */
return 0;
}
-#endif
+#endif /* S_IFLNK */
/*
* copy_hardlink - copy a hardlink
#ifdef WITH_SELINUX
selinux_file_context (dst);
-#endif
+#endif /* WITH_SELINUX */
if ( (mknod (dst, statp->st_mode & ~07777, statp->st_rdev) != 0)
|| (chown (dst,
}
#ifdef WITH_SELINUX
selinux_file_context (dst);
-#endif
+#endif /* WITH_SELINUX */
ofd = open (dst, O_WRONLY | O_CREAT | O_TRUNC, statp->st_mode & 07777);
if ( (ofd < 0)
|| (fchown (ofd,
if (futimes (ofd, mt) != 0) {
return -1;
}
-#endif
+#endif /* HAVE_FUTIMES */
if (close (ofd) != 0) {
return -1;
if (utimes(dst, mt) != 0) {
return -1;
}
-#endif
+#endif /* !HAVE_FUTIMES */
return err;
}