summaryrefslogtreecommitdiffstats
path: root/src/pacman/sync.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pacman/sync.c')
-rw-r--r--src/pacman/sync.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 15eea955..1f2edb24 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -122,7 +122,7 @@ static int sync_cleandb(const char *dbpath, int keep_used)
static int sync_cleandb_all(void)
{
const char *dbpath;
- char newdbpath[PATH_MAX];
+ char *newdbpath;
int ret = 0;
dbpath = alpm_option_get_dbpath(config->handle);
@@ -135,8 +135,12 @@ static int sync_cleandb_all(void)
* only the unused sync dbs in dbpath/sync/ */
ret += sync_cleandb(dbpath, 0);
- sprintf(newdbpath, "%s%s", dbpath, "sync/");
+ if(asprintf(&newdbpath, "%s%s", dbpath, "sync/") < 0) {
+ ret += 1;
+ return ret;
+ }
ret += sync_cleandb(newdbpath, 1);
+ free(newdbpath);
printf(_("Database directory cleaned up\n"));
return ret;