Re: bash: Correct usage of F_SETFD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> include/filecntl.h in bash-4.1 has following:
> 
> #define SET_CLOSE_ON_EXEC(fd)  (fcntl ((fd), F_SETFD, FD_CLOEXEC))
> 
> Is that really the correct/intended usage of F_SETFD ?

     F_SETFD            Set the close-on-exec flag associated with fildes to
                        the low order bit of arg (0 or 1 as above).

> If kernel ever adds a new flag to the fd, this would end up clearing the
> other new flag right ?
> 
> Shouldn't bash use F_GETFD to get the current flags and set/clear just
> the FD_CLOEXEC bit ?

I suppose it would matter if there are systems that have more than one
flag value.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@xxxxxxxx    http://cnswww.cns.cwru.edu/~chet/
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux