2 * This work is licensed under the terms of the GNU GPL, version 2 or later.
3 * See the COPYING file in the top-level directory.
7 #include "qapi/error.h"
11 * @name: the pathname to open
12 * @flags: as in open()
15 * A wrapper for open() function which sets O_CLOEXEC.
17 * On error, -1 is returned.
19 int qga_open_cloexec(const char *name
, int flags
, mode_t mode
)
24 ret
= open(name
, flags
| O_CLOEXEC
, mode
);
26 ret
= open(name
, flags
, mode
);
28 qemu_set_cloexec(ret
);