Fix insecure file permissions when using FileFd with OpenMode::Atomic
authorMichael Vogt <mvo@ubuntu.com>
Wed, 9 Apr 2014 08:12:10 +0000 (10:12 +0200)
committerMichael Vogt <mvo@ubuntu.com>
Thu, 10 Apr 2014 06:59:47 +0000 (08:59 +0200)
commitf22b65b47990237bd5d9a1c171919c3059fbd9b0
treee22e54c3256554884b1042a2088638207b169ec3
parent5572f6bdcb947e11f32e2a035438d9d3899ad46d
Fix insecure file permissions when using FileFd with OpenMode::Atomic

Commit 7335eebea6dd43581d4650a8818b06383ab89901 introduced a bug
that caused FileFd to create insecure permissions when FileFd::Atomic
is used. This commit fixes the permissions and adds a test.

The bug is most likely caused by the confusing "Perm" parameter
that is passed to Open() - its not the file permissions but intead
the "mode" part of open/creat.
apt-pkg/contrib/fileutl.cc
test/libapt/fileutl_test.cc