mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
irmap: use xsprintf() in irmap_update_dir()
Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
cdd2733b0a
commit
7dd377ef0f
1 changed files with 2 additions and 6 deletions
8
irmap.c
8
irmap.c
|
|
@ -106,7 +106,7 @@ static int irmap_update_stat(struct irmap *i)
|
|||
*/
|
||||
static int irmap_update_dir(struct irmap *t)
|
||||
{
|
||||
int fd, nr = 0, dlen, mntns_root;
|
||||
int fd, nr = 0, mntns_root;
|
||||
DIR *dfd;
|
||||
struct dirent *de;
|
||||
|
||||
|
|
@ -122,7 +122,6 @@ static int irmap_update_dir(struct irmap *t)
|
|||
return -1;
|
||||
}
|
||||
|
||||
dlen = strlen(t->path);
|
||||
dfd = fdopendir(fd);
|
||||
if (!dfd) {
|
||||
pr_perror("Can't opendir %s", t->path);
|
||||
|
|
@ -145,12 +144,9 @@ static int irmap_update_dir(struct irmap *t)
|
|||
k->kids = NULL; /* for xrealloc above */
|
||||
k->ino = 0; /* for irmap_update_stat */
|
||||
k->nr_kids = -1; /* for irmap_update_dir */
|
||||
|
||||
k->path = xmalloc(dlen + strlen(de->d_name) + 2);
|
||||
k->path = xsprintf("%s/%s", t->path, de->d_name);
|
||||
if (!k->path)
|
||||
goto out_err;
|
||||
|
||||
sprintf(k->path, "%s/%s", t->path, de->d_name);
|
||||
}
|
||||
|
||||
if (errno) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue