]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Keep gcc happy with 'const' keyword.
authorVincent Bernat <bernat@luffy.cx>
Sun, 24 May 2009 18:45:47 +0000 (20:45 +0200)
committerVincent Bernat <bernat@luffy.cx>
Sun, 24 May 2009 19:08:57 +0000 (21:08 +0200)
With optimization -O0, gcc seems to handle more carefully 'const'
keyword.

src/lldpd.h
src/priv.c

index 19683ed5381b248a2cd9faccf01b795e17097dd2..29532423c3c4eea06b14c8117136647878b0c004 100644 (file)
@@ -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 */
index a2ac841d26ac031cfc2af4f545ec59286244a7a2..219ef1ddd2cd11f2b83c3f2fe9c55f9c9107532d 100644 (file)
@@ -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) {