On Mon, Jan 27, 2014 at 5:37 PM, Zbigniew Jędrzejewski-Szmek <[email protected]> wrote: > On Mon, Jan 27, 2014 at 11:52:48AM -0200, Lucas De Marchi wrote: >> On Sun, Jan 26, 2014 at 3:21 AM, Zbigniew Jędrzejewski-Szmek >> > +int open_tmpfile(const char *path, int flags) { >> > + int fd; >> > + char *p; >> > + >> > +#ifdef O_TMPFILE >> > + fd = open(path, flags | O_TMPFILE, S_IRUSR | S_IWUSR); >> > + if (fd >= 0) >> > + return fd; >> > +#endif >> > + p = strappenda(path, "/systemd-tmp-XXXXXX"); >> > + >> > + RUN_WITH_UMASK(0077) { >> > + fd = mkostemp(p, O_RDWR|O_CLOEXEC); >> > + } >> > + >> > + if (fd < 0) >> > + return -errno; >> > + >> > + unlink(path); >> >> This unlink() doesn't make much sense with O_TMPFILE. > > unlink is only reached if open(O_TMPFILE) failed and fd comes > from mkostemp.
Can we expect open(O_TMPFILE) to fail on kernels which do not support it? I guess they will just silently ignore it? Then we never unlink? Kay _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
