Committer: Rene Hummen <rene.hummen@xxxxxxxxxxxxxxxxx> Date: 26/05/2010 at 18:45:07 Revision: 4602 Revision-id: rene.hummen@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Branch nick: trunk Log: reverted previous commit Modified: M hipd/init.c === modified file 'hipd/init.c' --- hipd/init.c 2010-05-26 15:38:51 +0000 +++ hipd/init.c 2010-05-26 15:45:03 +0000 @@ -84,6 +84,31 @@ } /** + * set or unset close-on-exec flag for a given file descriptor + * + * @param desc the file descriptor + * @param value 1 if to set or zero for unset + * @return the previous flags + */ +static int set_cloexec_flag(int desc, int value) +{ + int oldflags = fcntl(desc, F_GETFD, 0); + /* If reading the flags failed, return error indication now.*/ + if (oldflags < 0) { + return oldflags; + } + /* Set just the flag we want to set. */ + + if (value != 0) { + oldflags |= FD_CLOEXEC; + } else { + oldflags &= ~FD_CLOEXEC; + } + /* Store modified flag word in the descriptor. */ + return fcntl(desc, F_SETFD, oldflags); +} + +/** * Create a file with the given contents unless it already exists * * @param path the file with its path @@ -491,31 +516,6 @@ } /** - * set or unset close-on-exec flag for a given file descriptor - * - * @param desc the file descriptor - * @param value 1 if to set or zero for unset - * @return the previous flags - */ -int set_cloexec_flag(int desc, int value) -{ - int oldflags = fcntl(desc, F_GETFD, 0); - /* If reading the flags failed, return error indication now.*/ - if (oldflags < 0) { - return oldflags; - } - /* Set just the flag we want to set. */ - - if (value != 0) { - oldflags |= FD_CLOEXEC; - } else { - oldflags &= ~FD_CLOEXEC; - } - /* Store modified flag word in the descriptor. */ - return fcntl(desc, F_SETFD, oldflags); -} - -/** * create a socket to handle UDP encapsulation of HIP control * packets *