Re: Would O_APPEND for /dev/null be possible?

From: Bryan Drewery <bdrewery_at_FreeBSD.org>
Date: Wed, 9 Aug 2017 13:02:27 -0700
On 8/7/2017 2:36 PM, Steffen Nurpmeso wrote:
> I can open a file with "a+", which, for this software, means
> "O_RDWR | O_APPEND | O_CREAT | n_O_NOFOLLOW" on Linux, Solaris and
> OpenBSD, but FreeBSD complains, i think because O_APPEND.  (I
> think only because the VM does not survive resumes and other
> pauses here, which frustrated me over time.  It is old VM.)
> I mean, it seems i have to sprinkle more /dev/null string
> comparisons all over the place, but i wonder whether that really
> belongs there.. for /dev/null?

> # cat uh.c
> #include <err.h>
> #include <fcntl.h>
> 
> int main() {
>         int fd;
> 
>         fd = open("/dev/null", O_RDWR | O_APPEND | O_CREAT | O_NOFOLLOW);
>         if (fd == -1)
>                 err(1, "open");
>         return 0;
> }

> # truss ./uh
...
> openat(AT_FDCWD,"/dev/null",O_RDWR|O_APPEND|O_NOFOLLOW|O_CREAT,037777762520) = 3 (0x3)

Seems to work fine.

-- 
Regards,
Bryan Drewery


Received on Wed Aug 09 2017 - 18:02:37 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:12 UTC