* libmisc/copydir.c: Document the sections closed by #endif
This commit is contained in:
parent
cfce9890fb
commit
6afd7859f8
@ -1,3 +1,7 @@
|
|||||||
|
2010-03-30 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
* libmisc/copydir.c: Document the sections closed by #endif
|
||||||
|
|
||||||
2010-03-27 Nicolas François <nicolas.francois@centraliens.net>
|
2010-03-27 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* man/vipw.8.xml: Add section ENVIRONMENT.
|
* man/vipw.8.xml: Add section ENVIRONMENT.
|
||||||
@ -132,7 +136,7 @@
|
|||||||
2010-03-18 Nicolas François <nicolas.francois@centraliens.net>
|
2010-03-18 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* lib/tcbfuncs.h: Re-indent.
|
* lib/tcbfuncs.h: Re-indent.
|
||||||
* lib/tcbfuncs.h: Explicitly indicate functiontakinga void
|
* lib/tcbfuncs.h: Explicitly indicate function taking a void
|
||||||
parameter.
|
parameter.
|
||||||
|
|
||||||
2010-03-18 Nicolas François <nicolas.francois@centraliens.net>
|
2010-03-18 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
#include <selinux/selinux.h>
|
#include <selinux/selinux.h>
|
||||||
#endif
|
#endif /* WITH_SELINUX */
|
||||||
static /*@null@*/const char *src_orig;
|
static /*@null@*/const char *src_orig;
|
||||||
static /*@null@*/const char *dst_orig;
|
static /*@null@*/const char *dst_orig;
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ static char *readlink_malloc (const char *filename);
|
|||||||
static int copy_symlink (const char *src, const char *dst,
|
static int copy_symlink (const char *src, const char *dst,
|
||||||
const struct stat *statp, const struct timeval mt[],
|
const struct stat *statp, const struct timeval mt[],
|
||||||
long int uid, long int gid);
|
long int uid, long int gid);
|
||||||
#endif
|
#endif /* S_IFLNK */
|
||||||
static int copy_hardlink (const char *src, const char *dst,
|
static int copy_hardlink (const char *src, const char *dst,
|
||||||
struct link_name *lp);
|
struct link_name *lp);
|
||||||
static int copy_special (const char *dst,
|
static int copy_special (const char *dst,
|
||||||
@ -117,7 +117,7 @@ int selinux_file_context (const char *dst_name)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* WITH_SELINUX */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* remove_link - delete a link from the linked list
|
* remove_link - delete a link from the linked list
|
||||||
@ -281,7 +281,7 @@ int copy_tree (const char *src_root, const char *dst_root,
|
|||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
/* Reset SELinux to create files with default contexts */
|
/* Reset SELinux to create files with default contexts */
|
||||||
setfscreatecon (NULL);
|
setfscreatecon (NULL);
|
||||||
#endif
|
#endif /* WITH_SELINUX */
|
||||||
|
|
||||||
/* FIXME: with the call to remove_link, we could also check that
|
/* FIXME: with the call to remove_link, we could also check that
|
||||||
* no links remain in links.
|
* no links remain in links.
|
||||||
@ -319,26 +319,26 @@ static int copy_entry (const char *src, const char *dst,
|
|||||||
#ifdef HAVE_STRUCT_STAT_ST_ATIM
|
#ifdef HAVE_STRUCT_STAT_ST_ATIM
|
||||||
mt[0].tv_sec = sb.st_atim.tv_sec;
|
mt[0].tv_sec = sb.st_atim.tv_sec;
|
||||||
mt[0].tv_usec = sb.st_atim.tv_nsec / 1000;
|
mt[0].tv_usec = sb.st_atim.tv_nsec / 1000;
|
||||||
#else
|
#else /* !HAVE_STRUCT_STAT_ST_ATIM */
|
||||||
mt[0].tv_sec = sb.st_atime;
|
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;
|
mt[0].tv_usec = sb.st_atimensec / 1000;
|
||||||
#else
|
# else /* !HAVE_STRUCT_STAT_ST_ATIMENSEC */
|
||||||
mt[0].tv_usec = 0;
|
mt[0].tv_usec = 0;
|
||||||
#endif
|
# endif /* !HAVE_STRUCT_STAT_ST_ATIMENSEC */
|
||||||
#endif
|
#endif /* !HAVE_STRUCT_STAT_ST_ATIM */
|
||||||
|
|
||||||
#ifdef HAVE_STRUCT_STAT_ST_MTIM
|
#ifdef HAVE_STRUCT_STAT_ST_MTIM
|
||||||
mt[1].tv_sec = sb.st_mtim.tv_sec;
|
mt[1].tv_sec = sb.st_mtim.tv_sec;
|
||||||
mt[1].tv_usec = sb.st_mtim.tv_nsec / 1000;
|
mt[1].tv_usec = sb.st_mtim.tv_nsec / 1000;
|
||||||
#else
|
#else /* !HAVE_STRUCT_STAT_ST_MTIM */
|
||||||
mt[1].tv_sec = sb.st_mtime;
|
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;
|
mt[1].tv_usec = sb.st_mtimensec / 1000;
|
||||||
#else
|
# else /* !HAVE_STRUCT_STAT_ST_MTIMENSEC */
|
||||||
mt[1].tv_usec = 0;
|
mt[1].tv_usec = 0;
|
||||||
#endif
|
# endif /* !HAVE_STRUCT_STAT_ST_MTIMENSEC */
|
||||||
#endif
|
#endif /* !HAVE_STRUCT_STAT_ST_MTIM */
|
||||||
|
|
||||||
if (S_ISDIR (sb.st_mode)) {
|
if (S_ISDIR (sb.st_mode)) {
|
||||||
err = copy_dir (src, dst, &sb, mt, uid, gid);
|
err = copy_dir (src, dst, &sb, mt, uid, gid);
|
||||||
@ -352,7 +352,7 @@ static int copy_entry (const char *src, const char *dst,
|
|||||||
else if (S_ISLNK (sb.st_mode)) {
|
else if (S_ISLNK (sb.st_mode)) {
|
||||||
err = copy_symlink (src, dst, &sb, mt, uid, gid);
|
err = copy_symlink (src, dst, &sb, mt, uid, gid);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* S_IFLNK */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* See if this is a previously copied link
|
* See if this is a previously copied link
|
||||||
@ -408,7 +408,7 @@ static int copy_dir (const char *src, const char *dst,
|
|||||||
|
|
||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
selinux_file_context (dst);
|
selinux_file_context (dst);
|
||||||
#endif
|
#endif /* WITH_SELINUX */
|
||||||
if ( (mkdir (dst, statp->st_mode) != 0)
|
if ( (mkdir (dst, statp->st_mode) != 0)
|
||||||
|| (chown (dst,
|
|| (chown (dst,
|
||||||
(uid == - 1) ? statp->st_uid : (uid_t) uid,
|
(uid == - 1) ? statp->st_uid : (uid_t) uid,
|
||||||
@ -509,7 +509,7 @@ static int copy_symlink (const char *src, const char *dst,
|
|||||||
|
|
||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
selinux_file_context (dst);
|
selinux_file_context (dst);
|
||||||
#endif
|
#endif /* WITH_SELINUX */
|
||||||
if ( (symlink (oldlink, dst) != 0)
|
if ( (symlink (oldlink, dst) != 0)
|
||||||
|| (lchown (dst,
|
|| (lchown (dst,
|
||||||
(uid == -1) ? statp->st_uid : (uid_t) uid,
|
(uid == -1) ? statp->st_uid : (uid_t) uid,
|
||||||
@ -526,11 +526,11 @@ static int copy_symlink (const char *src, const char *dst,
|
|||||||
* - not implemented
|
* - not implemented
|
||||||
*/
|
*/
|
||||||
lutimes (dst, mt);
|
lutimes (dst, mt);
|
||||||
#endif
|
#endif /* HAVE_LUTIMES */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* S_IFLNK */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* copy_hardlink - copy a hardlink
|
* copy_hardlink - copy a hardlink
|
||||||
@ -582,7 +582,7 @@ static int copy_special (const char *dst,
|
|||||||
|
|
||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
selinux_file_context (dst);
|
selinux_file_context (dst);
|
||||||
#endif
|
#endif /* WITH_SELINUX */
|
||||||
|
|
||||||
if ( (mknod (dst, statp->st_mode & ~07777, statp->st_rdev) != 0)
|
if ( (mknod (dst, statp->st_mode & ~07777, statp->st_rdev) != 0)
|
||||||
|| (chown (dst,
|
|| (chown (dst,
|
||||||
@ -622,7 +622,7 @@ static int copy_file (const char *src, const char *dst,
|
|||||||
}
|
}
|
||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
selinux_file_context (dst);
|
selinux_file_context (dst);
|
||||||
#endif
|
#endif /* WITH_SELINUX */
|
||||||
ofd = open (dst, O_WRONLY | O_CREAT | O_TRUNC, statp->st_mode & 07777);
|
ofd = open (dst, O_WRONLY | O_CREAT | O_TRUNC, statp->st_mode & 07777);
|
||||||
if ( (ofd < 0)
|
if ( (ofd < 0)
|
||||||
|| (fchown (ofd,
|
|| (fchown (ofd,
|
||||||
@ -646,7 +646,7 @@ static int copy_file (const char *src, const char *dst,
|
|||||||
if (futimes (ofd, mt) != 0) {
|
if (futimes (ofd, mt) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* HAVE_FUTIMES */
|
||||||
|
|
||||||
if (close (ofd) != 0) {
|
if (close (ofd) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -656,7 +656,7 @@ static int copy_file (const char *src, const char *dst,
|
|||||||
if (utimes(dst, mt) != 0) {
|
if (utimes(dst, mt) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* !HAVE_FUTIMES */
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user