maybe a bug in copy files
Egmont Koblinger
egmont at uhulinux.hu
Thu Feb 22 14:27:38 UTC 2007
Hi,
> [...] As it can be
> seen the patch posted by Andrew calls chmod() on the target
> file only if "preserve attributes" is set. However, it has to
> be called in both cases since the destination file is created
> with mode 600 initially due to security concerns - more info
> can be found in file.c .
I think this is overcomplicated... open() does not create the file with the
permission taken from its third argument, it masks it with umask. So
currently the file is not created with mode 600, but with mode (600 &
^umask).
What's wrong with the following simple solution?
When creating the file, pass the permissions of the old file to the open()
call. This way it will have no more permissions than the original file, and
no more permission than umask suggests.
When copying is finished, call chmod() only if preserve attributes is set.
--
Egmont
More information about the mc-devel
mailing list