summaryrefslogtreecommitdiff
path: root/e2fsprogs/chattr.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-04-25 05:24:35 +0000
committerMike Frysinger <vapier@gentoo.org>2005-04-25 05:24:35 +0000
commitc238a97a9e90734da15163ba54d6862bb8e360e9 (patch)
tree5f7aa8b3884f523eea53f35e69a77362ca352235 /e2fsprogs/chattr.c
parent7eb6457c4cf76ace4e738c01911c78ec52e51840 (diff)
downloadbusybox-w32-c238a97a9e90734da15163ba54d6862bb8e360e9.tar.gz
busybox-w32-c238a97a9e90734da15163ba54d6862bb8e360e9.tar.bz2
busybox-w32-c238a97a9e90734da15163ba54d6862bb8e360e9.zip
use asprintf in place of malloc/sprintf as suggested by solar
Diffstat (limited to 'e2fsprogs/chattr.c')
-rw-r--r--e2fsprogs/chattr.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/e2fsprogs/chattr.c b/e2fsprogs/chattr.c
index 5aaa14fbb..07cee8f7c 100644
--- a/e2fsprogs/chattr.c
+++ b/e2fsprogs/chattr.c
@@ -167,11 +167,9 @@ static int chattr_dir_proc(const char *dir_name, struct dirent *de,
167 /*if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {*/ 167 /*if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {*/
168 if (de->d_name[0] == '.' && (de->d_name[1] == '\0' || \ 168 if (de->d_name[0] == '.' && (de->d_name[1] == '\0' || \
169 (de->d_name[1] == '.' && de->d_name[2] == '\0'))) { 169 (de->d_name[1] == '.' && de->d_name[2] == '\0'))) {
170 170 char *path;
171 char *path = malloc(strlen(dir_name) + 1 + strlen(de->d_name) + 1); 171 if (asprintf(&path, "%s/%s", dir_name, de->d_name) == -1)
172 if (!path) 172 bb_error_msg_and_die("asprintf failed");
173 bb_error_msg_and_die("Couldn't allocate path variable in chattr_dir_proc");
174 sprintf(path, "%s/%s", dir_name, de->d_name);
175 change_attributes(path); 173 change_attributes(path);
176 free(path); 174 free(path);
177 } 175 }