summaryrefslogtreecommitdiff
path: root/glnx-lockfile.c
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: Use glnx_autofd and glnx_close_fd()Colin Walters2017-10-161-1/+1
| | | | | Port to `glnx_autofd` tree wide, and add one missed `glnx_close_fd()` use in the tmpfile code.
* Add glnx_fd_close() and glnx_autofdColin Walters2017-10-061-5/+2
| | | | | | | | | | | | | I'd like to have the checks for `EBADF` as well as the "assign to -1" in more places. The cleanup function we had for `glnx_fd_close` is actually what we want. Let's rename the cleanup macro to `glnx_autofd` to better match other autocleanups like `g_autofree`. Then we can use `glnx_fd_close()` as a replacement for plain Unix `close()`. I left the `glnx_close_fd` macro, but it's obviously confusing now with the former. We'll eventually remove it.
* lockfile: Use an `initialized` member rather than explicit initColin Walters2017-09-251-7/+5
| | | | | | | | | This makes us more friendly to being embedded in a GObject or the like that's fully zero-initialized, rather than relying on the special `-1` value for the fd. Calls to `glnx_release_lock_file()` become idempotent, so it's easy to call it unconditionally in an object finalizer.
* tree-wide: Use our own syscall wrappers or error prefixingColin Walters2017-09-131-4/+3
| | | | Followup to similar commits in the ostree stack recently.
* Port most code (except fdio) to new styleColin Walters2017-04-251-16/+7
| | | | There's a lot more fdio code, starting with some of the easier ones.
* glnx_release_lock_file - Don't close fd -1 (i.e. if we never locked)Alexander Larsson2016-06-281-1/+2
| | | | | This happens a lot if you use autocleanup for lock files, and the function returns early without the lock being taken.
* lockfile: New code to lock files, massaged from systemdColin Walters2015-05-051-0/+193
Will be used by OSTree to lock the sysroot against concurrent manipulation. Taken from current systemd git master, tweaked to GLibify.