summaryrefslogtreecommitdiff
path: root/glnx-local-alloc.h
Commit message (Collapse)AuthorAgeFilesLines
* Add glnx_fd_close() and glnx_autofdColin Walters2017-10-061-12/+26
| | | | | | | | | | | | | 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.
* local-alloc: Remove almost all macros like glnx_free, glnx_unref_variantColin Walters2017-07-311-159/+8
| | | | | | | | | | We should be able to rely upstream on everything *except* `glnx_unref_object` which requires the library itself to depend on a newer glib, which isn't true for e.g. RHEL7 libsoup. libostree was almost ready for this; just a few patches to push it to completion in https://github.com/ostreedev/ostree/pull/1042
* localalloc: Abort on EBADF from close() by defaultColin Walters2017-07-261-1/+2
| | | | | | systemd does this by default. I think we should treat this as a fatal error since it can cause really painful-to-debug problems if we don't just get EBADF but actually close something else's fd due to a race.
* glnx-local-alloc: Make check for invalid FDs more generalPhilip Withnall2017-04-211-2/+2
| | | | | | | | In general, all FDs < 0 are invalid (and should not have close() called on them), so check that. This could have caused problems if a function returned an error value < -1. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* Don't touch errno in glnx_fd_closeAlexander Larsson2016-03-101-2/+7
| | | | | | We're ignoring the result from the close, but it can still affect errno, which is bad if you use this in functions that sets errno, because errno can unexpectedly change after you've set it.
* Add glnx_steal_fdAlexander Larsson2015-12-111-0/+8
| | | | | | This is very useful in combination with glnx_close_fd https://bugzilla.gnome.org/show_bug.cgi?id=757611
* Initial commit; backport of GLib autoptr codeColin Walters2015-02-141-0/+214
This module is a new successor to libgsystem. It currently contains a backport of the GLib cleanup macros, but soon more Linux-specific code will be added.