From: Nathan Wagner Date: Fri, 14 Sep 2012 06:47:32 +0000 (+0000) Subject: Fixed file descriptor leak getting linux mac addr. X-Git-Url: https://pd.if.org/git/?p=uuid;a=commitdiff_plain;h=86b30d90a32ec2f409ddfff4fb8f1a2b6a77413f Fixed file descriptor leak getting linux mac addr. --- diff --git a/internal.c b/internal.c index 02f3e87..59e1bbf 100644 --- a/internal.c +++ b/internal.c @@ -17,6 +17,7 @@ #include #include #include +#include #endif #ifdef __APPLE__ @@ -193,10 +194,12 @@ static uint64_t current_node(struct pd_uuid_state *st) { node = node << 8; node += data[3]; node = node << 8; node += data[4]; node = node << 8; node += data[5]; + close(s); return node; } } } + close(s); } #endif @@ -343,6 +346,7 @@ int pd_uuid_make_v1(struct pd_uuid_state *s, pd_uuid_t *uuid) { if (!s->available || s->node != node) { s->clock_sequence = random_clock_sequence(s); } + s->node = node; if (s->available && s->timestamp > now) {