version 1.10, 2019/02/16 10:46:22 |
version 1.11, 2019/02/16 10:47:20 |
|
|
int32_t idx, rawtok; |
int32_t idx, rawtok; |
const struct flist *f; |
const struct flist *f; |
size_t sz, tok; |
size_t sz, tok; |
mode_t perm; |
|
struct stat st; |
struct stat st; |
char *buf = NULL; |
char *buf = NULL; |
unsigned char ourmd[MD4_DIGEST_LENGTH], |
unsigned char ourmd[MD4_DIGEST_LENGTH], |
|
|
|
|
if ((p->fd = mkstempat(p->rootfd, p->fname)) == -1) { |
if ((p->fd = mkstempat(p->rootfd, p->fname)) == -1) { |
ERR(sess, "%s: openat", p->fname); |
ERR(sess, "%s: openat", p->fname); |
goto out; |
|
} |
|
|
|
/* |
|
* Inherit permissions from the source file if we're new |
|
* or specifically told with -p. |
|
*/ |
|
|
|
if (!sess->opts->preserve_perms) |
|
perm = -1 == p->ofd ? f->st.mode : st.st_mode; |
|
else |
|
perm = f->st.mode; |
|
|
|
if (fchmod(p->fd, perm) == -1) { |
|
ERR(sess, "%s: fchmod", p->fname); |
|
(void)unlinkat(p->rootfd, p->fname, 0); |
|
goto out; |
goto out; |
} |
} |
|
|