lib/pkgdb.c: set a sane umask for pkgdb plist
This commit is contained in:
parent
66c6331689
commit
44778867df
@ -216,6 +216,7 @@ int
|
|||||||
xbps_pkgdb_update(struct xbps_handle *xhp, bool flush, bool update)
|
xbps_pkgdb_update(struct xbps_handle *xhp, bool flush, bool update)
|
||||||
{
|
{
|
||||||
xbps_dictionary_t pkgdb_storage;
|
xbps_dictionary_t pkgdb_storage;
|
||||||
|
mode_t prev_umask;
|
||||||
static int cached_rv;
|
static int cached_rv;
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
@ -227,8 +228,12 @@ xbps_pkgdb_update(struct xbps_handle *xhp, bool flush, bool update)
|
|||||||
if (pkgdb_storage == NULL ||
|
if (pkgdb_storage == NULL ||
|
||||||
!xbps_dictionary_equals(xhp->pkgdb, pkgdb_storage)) {
|
!xbps_dictionary_equals(xhp->pkgdb, pkgdb_storage)) {
|
||||||
/* flush dictionary to storage */
|
/* flush dictionary to storage */
|
||||||
if (!xbps_dictionary_externalize_to_file(xhp->pkgdb, xhp->pkgdb_plist))
|
prev_umask = umask(022);
|
||||||
|
if (!xbps_dictionary_externalize_to_file(xhp->pkgdb, xhp->pkgdb_plist)) {
|
||||||
|
umask(prev_umask);
|
||||||
return errno;
|
return errno;
|
||||||
|
}
|
||||||
|
umask(prev_umask);
|
||||||
}
|
}
|
||||||
if (pkgdb_storage)
|
if (pkgdb_storage)
|
||||||
xbps_object_release(pkgdb_storage);
|
xbps_object_release(pkgdb_storage);
|
||||||
|
Loading…
Reference in New Issue
Block a user