limb 0.2.0

2024-01-09

open_tmpat(3)
limb manual
open_tmpat(3)

NAME

open_tmpat - open a new temporary file

SYNOPSIS

#include <limb/unix-transactional.h>
int open_tmpat(int fd, char *name)

DESCRIPTION

The open_tmpat() function opens a new temporary file for writing, using a name based on the template pointed by name - which must end with at least 6 characters X that will be replaced with random (printable) characters.

The memory pointed by name will be modified, replacing the trailing X characters so that name contains the name of the file actually opened.

If name describes a relative path, it is relative to the directory associated with the file descriptor fd, which may be AT_FDCWD to use the current working directory.

Note

It is actually implemented as a macro to mkfiletempat(3).

RETURN VALUE

The open_tmpat() function returns the opened file descriptor on success. Otherwise it returns -1 and sets errno to indicate the error.

ERRORS

The open_tmpat() function may fail if :

EINVAL

The template pointed by name does not end with at least 6 X.

It may also fail and set errno for the errors described for open_exclat(3).

limb 0.1.0
2023-07-24
open_tmpat(3)