Commit 7dd377ef authored by Stanislav Kinsburskiy's avatar Stanislav Kinsburskiy Committed by Pavel Emelyanov

irmap: use xsprintf() in irmap_update_dir()

Signed-off-by: 's avatarStanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent cdd2733b
...@@ -106,7 +106,7 @@ static int irmap_update_stat(struct irmap *i) ...@@ -106,7 +106,7 @@ static int irmap_update_stat(struct irmap *i)
*/ */
static int irmap_update_dir(struct irmap *t) static int irmap_update_dir(struct irmap *t)
{ {
int fd, nr = 0, dlen, mntns_root; int fd, nr = 0, mntns_root;
DIR *dfd; DIR *dfd;
struct dirent *de; struct dirent *de;
...@@ -122,7 +122,6 @@ static int irmap_update_dir(struct irmap *t) ...@@ -122,7 +122,6 @@ static int irmap_update_dir(struct irmap *t)
return -1; return -1;
} }
dlen = strlen(t->path);
dfd = fdopendir(fd); dfd = fdopendir(fd);
if (!dfd) { if (!dfd) {
pr_perror("Can't opendir %s", t->path); pr_perror("Can't opendir %s", t->path);
...@@ -145,12 +144,9 @@ static int irmap_update_dir(struct irmap *t) ...@@ -145,12 +144,9 @@ static int irmap_update_dir(struct irmap *t)
k->kids = NULL; /* for xrealloc above */ k->kids = NULL; /* for xrealloc above */
k->ino = 0; /* for irmap_update_stat */ k->ino = 0; /* for irmap_update_stat */
k->nr_kids = -1; /* for irmap_update_dir */ k->nr_kids = -1; /* for irmap_update_dir */
k->path = xsprintf("%s/%s", t->path, de->d_name);
k->path = xmalloc(dlen + strlen(de->d_name) + 2);
if (!k->path) if (!k->path)
goto out_err; goto out_err;
sprintf(k->path, "%s/%s", t->path, de->d_name);
} }
if (errno) { if (errno) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment