sprintf -> asprintf

This commit is contained in:
Дмитрий Левин 2002-03-30 16:07:14 +00:00
parent 14b947cb6c
commit 3fdf6f7ff1

View File

@ -3397,11 +3397,12 @@ int rpmdbRebuild(const char * prefix)
tfn = rpmGetPath("%{_dbpath_rebuild}", NULL);
/*@=nullpass@*/
if (!(tfn && tfn[0] != '%' && strcmp(tfn, dbpath))) {
char pidbuf[20];
char *pidbuf;
char *t;
sprintf(pidbuf, "rebuilddb.%d", (int) getpid());
asprintf(&pidbuf, "rebuilddb.%u", getpid());
t = xmalloc(strlen(dbpath) + strlen(pidbuf) + 1);
(void)stpcpy(stpcpy(t, dbpath), pidbuf);
pidbuf = _free(pidbuf);
tfn = _free(tfn);
tfn = t;
nocleanup = 0;