aboutsummaryrefslogtreecommitdiff
path: root/toys/other
diff options
context:
space:
mode:
authorAlessio Balsini <balsini@android.com>2019-10-22 11:31:05 +0100
committerRob Landley <rob@landley.net>2019-10-26 17:38:34 -0500
commitb7265da4ccdfe4d256e72dc1b2a0f6b54e087ad2 (patch)
tree793e5f4c4d7a0d8cc7f548d2a2b6bbc67a7d8d80 /toys/other
parent55d937611597a4e54a17b344c81810ad1fe9f75d (diff)
downloadtoybox-b7265da4ccdfe4d256e72dc1b2a0f6b54e087ad2.tar.gz
losetup: Change variable name to improve readability
Having a dynamic memory pointer named as "s", issuing "free(s)" and then performing "FLAG(s)" is correct: "FLAG(s)" is a macro which uses "s" as a token and expands as "FLAG_s". At a glance, this would instead look like a use-after-free violation. Fix this readability issue by renaming the "s" pointer variable to "f_path". Change-Id: I51f139034a7dcd67a08a6952bc22c1a904162c65 Signed-off-by: Alessio Balsini <balsini@android.com>
Diffstat (limited to 'toys/other')
-rw-r--r--toys/other/losetup.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/toys/other/losetup.c b/toys/other/losetup.c
index 7f91ba1f..27d25a18 100644
--- a/toys/other/losetup.c
+++ b/toys/other/losetup.c
@@ -103,16 +103,16 @@ static int loopback_setup(char *device, char *file)
}
// Associate file with this device?
} else if (file) {
- char *s = xabspath(file, 1);
+ char *f_path = xabspath(file, 1);
- if (!s) perror_exit("file"); // already opened, but if deleted since...
+ if (!f_path) perror_exit("file"); // already opened, but if deleted since...
if (ioctl(lfd, LOOP_SET_FD, ffd)) {
- free(s);
+ free(f_path);
if (racy && errno == EBUSY) return 1;
perror_exit("%s=%s", device, file);
}
- xstrncpy((char *)loop->lo_file_name, s, LO_NAME_SIZE);
- free(s);
+ xstrncpy((char *)loop->lo_file_name, f_path, LO_NAME_SIZE);
+ free(f_path);
loop->lo_offset = TT.o;
loop->lo_sizelimit = TT.S;
if (ioctl(lfd, LOOP_SET_STATUS64, loop)) perror_exit("%s=%s", device, file);