Package: at
Version: 3.1.20-1
Severity: important

Dear Maintainer,

Please see this code.
This is a part of daemon_setup() function in "daemon.c".

========================   daemon.c: line 204
/* We do NOT close fd, since we want to keep the lock. However, we don't
     * want to keep the file descriptor in case of an exec().
     */
    fflush(fp);
    fcntl(fd, F_SETFD, (long) 1);
    PRIV_END

    return;
}
========================   end of citation

In this code, We give "1L" as the 3rd argument of fcntl().
but I seems that Linux kernel ignores its value.

========================   linux-4.4.15/linux/fs/fcntl.c: line 255
        case F_GETFD:
                err = get_close_on_exec(fd) ? FD_CLOEXEC : 0;
                break;
        case F_SETFD:
                err = 0;
                set_close_on_exec(fd, arg & FD_CLOEXEC);
                break;
========================   end of citation


[wrong]     fcntl(fd, F_SETFD, (long) 1);
[correct]   fcntl(fd, F_SETFD, FD_CLOEXEC);



--
Hitoshi Ozeki hts.ozeki (at) gmail.com

Reply via email to