eal/bsd: fix fd leak
authorDavid Marchand <david.marchand@6wind.com>
Tue, 26 Aug 2014 14:11:38 +0000 (16:11 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 29 Sep 2014 12:39:09 +0000 (14:39 +0200)
From man(4) io:
"The initial implementation simply raised the IOPL of the current thread
when open(2) was called on the device. This behaviour is retained in the
current implementation as legacy support for both i386 and amd64."
    http://www.freebsd.org/cgi/man.cgi?query=io&sektion=4

Nothing prevents from closing it just after.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
lib/librte_eal/bsdapp/eal/eal.c

index df1946c..ae21e28 100644 (file)
@@ -497,6 +497,7 @@ rte_eal_iopl_init(void)
        fd = open("/dev/io", O_RDWR);
        if (fd < 0)
                return -1;
+       close(fd);
        return 0;
 }