The mode of files created by ctm_rmail was always 0600, even if the
umask was less restrictive. This was caused by the use of mkstemp() which internally passes a mode of 0600 to open(). Fix this by explicitly chmod'ing the files to (0666 & ~umask). PR: bin/16119 Submitted by: Sascha Blank <blank@uni-trier.de>
This commit is contained in:
parent
be44fce4fa
commit
673158816b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=89675
@ -33,6 +33,7 @@ char *base_dir = NULL; /* The tree to apply deltas to. */
|
|||||||
int delete_after = 0; /* Delete deltas after ctm applies them. */
|
int delete_after = 0; /* Delete deltas after ctm applies them. */
|
||||||
int apply_verbose = 0; /* Run with '-v' */
|
int apply_verbose = 0; /* Run with '-v' */
|
||||||
int set_time = 0; /* Set the time of the files that is changed. */
|
int set_time = 0; /* Set the time of the files that is changed. */
|
||||||
|
int mask = 0; /* The current umask */
|
||||||
|
|
||||||
void apply_complete(void);
|
void apply_complete(void);
|
||||||
int read_piece(char *input_file);
|
int read_piece(char *input_file);
|
||||||
@ -62,6 +63,9 @@ main(int argc, char **argv)
|
|||||||
int status = 0;
|
int status = 0;
|
||||||
int fork_ctm = 0;
|
int fork_ctm = 0;
|
||||||
|
|
||||||
|
mask = umask(0);
|
||||||
|
umask(mask);
|
||||||
|
|
||||||
err_prog_name(argv[0]);
|
err_prog_name(argv[0]);
|
||||||
|
|
||||||
OPTIONS("[-Dfuv] [-p piecedir] [-d deltadir] [-b basedir] [-l log] [file ...]")
|
OPTIONS("[-Dfuv] [-p piecedir] [-d deltadir] [-b basedir] [-l log] [file ...]")
|
||||||
@ -444,6 +448,7 @@ combine_if_complete(char *delta, int pce, int npieces)
|
|||||||
mk_piece_name(pname, delta, 1, 1);
|
mk_piece_name(pname, delta, 1, 1);
|
||||||
if (rename(pname, dname) == 0)
|
if (rename(pname, dname) == 0)
|
||||||
{
|
{
|
||||||
|
chmod(dname, 0666 & ~mask);
|
||||||
err("%s complete", delta);
|
err("%s complete", delta);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -555,6 +560,7 @@ combine(char *delta, int npieces, char *dname, char *pname, char *tname)
|
|||||||
unlink(tname);
|
unlink(tname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
chmod(dname, 0666 & ~mask);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Throw the pieces away.
|
* Throw the pieces away.
|
||||||
|
Loading…
Reference in New Issue
Block a user