]> git.ipfire.org Git - thirdparty/lldpd.git/commit
priv: correctly declare `priv_cmd` type
authorVincent Bernat <bernat@luffy.cx>
Thu, 11 Jul 2013 21:13:10 +0000 (23:13 +0200)
committerVincent Bernat <bernat@luffy.cx>
Thu, 11 Jul 2013 21:18:35 +0000 (23:18 +0200)
commit065732ca34138264e65f8784d5e97be388f08c71
tree93755bad15ba566b50b3e058134375099887b377
parentbcde9c0aa535eff71dab9101a30956a17ab5b1fb
priv: correctly declare `priv_cmd` type

`enum {} priv_cmd` was the declaration of a variable `priv_cmd` as an
anonymous enum. This is not what was expected. Instead, we want `enum
priv_cmd` to be a declaration of a named enum: `enum priv_cmd {}` (we
could also use `typedef enum {} priv_cmd`, but in lldpd, `typedef` is
seldomly used).

When `priv_cmd` was moved out of `priv.c`, its symbol was defined in
several objects. It seems that recent versions of gcc are able to cope
with that (because `priv_cmd` variable was not used, so it was
optimized out I think, not sure). However, some older versions like
4.2.1 complained about duplicate objects during the link phase.
src/daemon/lldpd.h
src/daemon/priv-linux.c
src/daemon/priv.c