aboutsummaryrefslogtreecommitdiff
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
parentb437df1157964ed012f1aeae25b68f6bbaae1787 (diff)
downloadbusybox-w32-51283b8109dc2fdaa3fefc5c5a93b6cda72cddfd.tar.gz
busybox-w32-51283b8109dc2fdaa3fefc5c5a93b6cda72cddfd.tar.bz2
busybox-w32-51283b8109dc2fdaa3fefc5c5a93b6cda72cddfd.zip
mdev: suppress aliasing warning
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-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)
808 } /* for (;;) */ 808 } /* for (;;) */
809} 809}
810 810
811static ssize_t readlink2(char *buf, size_t bufsize)
812{
813 // Grr... gcc 8.1.1:
814 // "passing argument 2 to restrict-qualified parameter aliases with argument 1"
815 // dance around that...
816 char *obuf FIX_ALIASING;
817 obuf = buf;
818 return readlink(buf, obuf, bufsize);
819}
820
811/* File callback for /sys/ traversal. 821/* File callback for /sys/ traversal.
812 * We act only on "/sys/.../dev" (pseudo)file 822 * We act only on "/sys/.../dev" (pseudo)file
813 */ 823 */
@@ -831,7 +841,7 @@ static int FAST_FUNC fileAction(const char *fileName,
831 /* Read ".../subsystem" symlink in the same directory where ".../dev" is */ 841 /* Read ".../subsystem" symlink in the same directory where ".../dev" is */
832 strcpy(subsys, path); 842 strcpy(subsys, path);
833 strcpy(subsys + len, "/subsystem"); 843 strcpy(subsys + len, "/subsystem");
834 res = readlink(subsys, subsys, sizeof(subsys)-1); 844 res = readlink2(subsys, sizeof(subsys)-1);
835 if (res > 0) { 845 if (res > 0) {
836 subsys[res] = '\0'; 846 subsys[res] = '\0';
837 free(G.subsystem); 847 free(G.subsystem);