X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tools%2Falg-test.c;h=a7404b74104de01e4f30ae756252f2ca19734688;hb=3a2ffc682f7517b06fdb16563a09a57946ce7811;hp=33c397566d0da0ce0f86f9797934a8081719b89a;hpb=daae038bc6618c9170ce7abb18faf0c753eeb77a;p=platform%2Fupstream%2Fconnman.git diff --git a/tools/alg-test.c b/tools/alg-test.c index 33c3975..a7404b7 100644 --- a/tools/alg-test.c +++ b/tools/alg-test.c @@ -23,6 +23,7 @@ #include #endif +#define _GNU_SOURCE #include #include #include @@ -60,7 +61,7 @@ static int create_hash(int sk, const char *pathname) struct stat st; int fd; - fd = open(pathname, O_RDONLY); + fd = open(pathname, O_RDONLY | O_CLOEXEC); if (fd < 0) return -1; @@ -85,7 +86,7 @@ static int create_socket(void) }; int sk, nsk; - sk = socket(PF_ALG, SOCK_SEQPACKET, 0); + sk = socket(PF_ALG, SOCK_SEQPACKET | SOCK_CLOEXEC, 0); if (sk < 0) { perror("Failed to create socket"); return -1;