FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 03-19-2011, 12:24 AM
Allan McRae
 
Default Use sane umask for repo db downloads

Fixes FS#23343.

Signed-off-by: Allan McRae <allan@archlinux.org>
---
lib/libalpm/be_sync.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 6c0d2d6..216213b 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -84,6 +84,7 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
struct stat buf;
size_t len;
int ret;
+ mode_t oldmask;

ALPM_LOG_FUNC;

@@ -104,6 +105,9 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
MALLOC(syncpath, len, RET_ERR(PM_ERR_MEMORY, -1));
sprintf(syncpath, "%s%s", dbpath, "sync/");

+ /* make sure we have a sane umask */
+ oldmask = umask(0022);
+
if(stat(syncpath, &buf) != 0) {
_alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it
",
syncpath);
@@ -124,6 +128,7 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
ret = _alpm_download_single_file(dbfile, db->servers, syncpath, force);
free(dbfile);
free(syncpath);
+ umask(oldmask);

if(ret == 1) {
/* files match, do nothing */
--
1.7.4.1
 
Old 03-19-2011, 12:28 AM
Dave Reisner
 
Default Use sane umask for repo db downloads

On Sat, Mar 19, 2011 at 11:24:22AM +1000, Allan McRae wrote:
> Fixes FS#23343.
>
> Signed-off-by: Allan McRae <allan@archlinux.org>
> ---
> lib/libalpm/be_sync.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
> index 6c0d2d6..216213b 100644
> --- a/lib/libalpm/be_sync.c
> +++ b/lib/libalpm/be_sync.c
> @@ -84,6 +84,7 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
> struct stat buf;
> size_t len;
> int ret;
> + mode_t oldmask;
>
> ALPM_LOG_FUNC;
>
> @@ -104,6 +105,9 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
> MALLOC(syncpath, len, RET_ERR(PM_ERR_MEMORY, -1));
> sprintf(syncpath, "%s%s", dbpath, "sync/");
>
> + /* make sure we have a sane umask */
> + oldmask = umask(0022);

Shouldn't this be 0133? We don't need the executable bit on tarballs.

> +
> if(stat(syncpath, &buf) != 0) {
> _alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it
",
> syncpath);
> @@ -124,6 +128,7 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
> ret = _alpm_download_single_file(dbfile, db->servers, syncpath, force);
> free(dbfile);
> free(syncpath);
> + umask(oldmask);
>
> if(ret == 1) {
> /* files match, do nothing */
> --
> 1.7.4.1
>
>

d
 

Thread Tools




All times are GMT. The time now is 07:21 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org