Provide a default sandboxuser
If sandboxuser is not set, pacman/libalpm does not handle moving incomplete download files out of the temporary download directories and into the cache. This leave download_XXXXXX directories in the cache that cause warnings on -Sc operations. Initialise the sandboxuser with the username of UID 0 (root on most systems). Fixes #209. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
ae603e35d7
commit
7ccf316ceb
1 changed files with 8 additions and 0 deletions
|
@ -25,6 +25,9 @@
|
|||
#include <curl/curl.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <pwd.h>
|
||||
|
||||
/* libalpm */
|
||||
#include "alpm.h"
|
||||
#include "alpm_list.h"
|
||||
|
@ -39,6 +42,7 @@ alpm_handle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath,
|
|||
const char *lf = "db.lck";
|
||||
char *hookdir;
|
||||
size_t hookdirlen, lockfilelen;
|
||||
struct passwd const *pw = NULL;
|
||||
alpm_handle_t *myhandle = _alpm_handle_new();
|
||||
|
||||
if(myhandle == NULL) {
|
||||
|
@ -78,6 +82,10 @@ alpm_handle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath,
|
|||
|
||||
myhandle->parallel_downloads = 1;
|
||||
|
||||
/* set default sandboxuser */
|
||||
ASSERT((pw = getpwuid(0)) != NULL, myerr = errno; goto cleanup);
|
||||
STRDUP(myhandle->sandboxuser, pw->pw_name, goto nomem);
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
bindtextdomain("libalpm", LOCALEDIR);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue