lldp: make sd_lldp_neighbor_tlv_rewind() return whether there's a first entry
authorLennart Poettering <lennart@poettering.net>
Thu, 2 Jun 2016 15:48:31 +0000 (17:48 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 6 Jun 2016 17:59:08 +0000 (19:59 +0200)
This way it's nicer to use as it matches how sd_lldp_neighbor_tlv_next()
indicates an EOF too via its return value.

src/libsystemd-network/lldp-neighbor.c

index 5811e0f..0ed680e 100644 (file)
@@ -686,7 +686,7 @@ _public_ int sd_lldp_neighbor_tlv_rewind(sd_lldp_neighbor *n) {
         assert(n->raw_size >= sizeof(struct ether_header));
         n->rindex = sizeof(struct ether_header);
 
-        return 0;
+        return n->rindex < n->raw_size;
 }
 
 _public_ int sd_lldp_neighbor_tlv_next(sd_lldp_neighbor *n) {