]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
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 5811e0f2e8b0624712d233b0f78f4eaa61d6d1ee..0ed680eecfbe923342ee92a6aa96fac5267b2524 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) {