From: Vincent Bernat Date: Sun, 24 May 2009 18:45:47 +0000 (+0200) Subject: Keep gcc happy with 'const' keyword. X-Git-Tag: 0.5.0~81 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ef76f9200685a79c8fe0e1a5e5dbca906634c223;p=thirdparty%2Flldpd.git Keep gcc happy with 'const' keyword. With optimization -O0, gcc seems to handle more carefully 'const' keyword. --- diff --git a/src/lldpd.h b/src/lldpd.h index 19683ed5..29532423 100644 --- a/src/lldpd.h +++ b/src/lldpd.h @@ -449,7 +449,7 @@ char *priv_gethostbyname(); int priv_open(char*); int priv_ethtool(char*, struct ethtool_cmd*); int priv_iface_init(struct lldpd_hardware *, int); -int priv_iface_multicast(char *, u_int8_t *, int); +int priv_iface_multicast(const char *, u_int8_t *, int); int priv_snmp_socket(struct sockaddr_un *); /* privsep_fdpass.c */ diff --git a/src/priv.c b/src/priv.c index a2ac841d..219ef1dd 100644 --- a/src/priv.c +++ b/src/priv.c @@ -57,7 +57,7 @@ enum { static int may_read(int, void *, size_t); static void must_read(int, void *, size_t); -static void must_write(int, void *, size_t); +static void must_write(int, const void *, size_t); static int remote; /* Other side */ static int monitored = -1; /* Child */ @@ -167,7 +167,7 @@ priv_iface_init(struct lldpd_hardware *hardware, int master) } int -priv_iface_multicast(char *name, u_int8_t *mac, int add) +priv_iface_multicast(const char *name, u_int8_t *mac, int add) { int cmd, rc; cmd = PRIV_IFACE_MULTICAST; @@ -268,7 +268,7 @@ asroot_open() SYSFS_CLASS_DMI "chassis_asset_tag", NULL }; - char **f; + const char **f; char *file; int fd, len, rc; regex_t preg; @@ -644,9 +644,9 @@ must_read(int fd, void *buf, size_t n) /* Write data with the assertion that it all has to be written, or * else abort the process. Based on atomicio() from openssh. */ static void -must_write(int fd, void *buf, size_t n) +must_write(int fd, const void *buf, size_t n) { - char *s = buf; + const char *s = buf; ssize_t res, pos = 0; while (n > pos) {