]> pd.if.org Git - uuid/commitdiff
Fixed file descriptor leak getting linux mac addr.
authorNathan Wagner <nw@hydaspes.if.org>
Fri, 14 Sep 2012 06:47:32 +0000 (06:47 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Fri, 14 Sep 2012 06:47:32 +0000 (06:47 +0000)
internal.c

index 02f3e8720b58bfc2cc3a6ab95f6b168355bcaf69..59e1bbf402d05b3416b1c1323e625f1f095b9e16 100644 (file)
@@ -17,6 +17,7 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <linux/if.h>
+#include <unistd.h>
 #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) {