diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index e71cb02a..6753692f 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -25,6 +25,9 @@ #include #endif +#include +#include + /* 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