aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mdev.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-12-08 15:41:17 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-12-08 15:41:17 +0100
commit51283b8109dc2fdaa3fefc5c5a93b6cda72cddfd (patch)
tree5f9191266bd43a4ca2d0bfd4d7a5a10de3f50306 /util-linux/mdev.c
parentb437df1157964ed012f1aeae25b68f6bbaae1787 (diff)
downloadbusybox-51283b8109dc2fdaa3fefc5c5a93b6cda72cddfd.tar.gz
mdev: suppress aliasing warning
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/mdev.c')
-rw-r--r--util-linux/mdev.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 4b4eeafba..5ad09e09a 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -808,6 +808,16 @@ static void make_device(char *device_name, char *path, int operation)
} /* for (;;) */
}
+static ssize_t readlink2(char *buf, size_t bufsize)
+{
+ // Grr... gcc 8.1.1:
+ // "passing argument 2 to restrict-qualified parameter aliases with argument 1"
+ // dance around that...
+ char *obuf FIX_ALIASING;
+ obuf = buf;
+ return readlink(buf, obuf, bufsize);
+}
+
/* File callback for /sys/ traversal.
* We act only on "/sys/.../dev" (pseudo)file
*/
@@ -831,7 +841,7 @@ static int FAST_FUNC fileAction(const char *fileName,
/* Read ".../subsystem" symlink in the same directory where ".../dev" is */
strcpy(subsys, path);
strcpy(subsys + len, "/subsystem");
- res = readlink(subsys, subsys, sizeof(subsys)-1);
+ res = readlink2(subsys, sizeof(subsys)-1);
if (res > 0) {
subsys[res] = '\0';
free(G.subsystem);