NetworkManager/shared
Thomas Haller e1ca3bf7ed shared: add nm_strerror_native() to replace strerror() and g_strerror()
We have various options for strerror(), with ups and downsides:

- strerror()

    - returns pointer that is overwritten on next call. It's convenient
      to use, but dangerous.

    - not thread-safe.

    - not guaranteed to be UTF-8.

- strerror_r()

    - takes input buffer and is less convenient to use. At least, we
      are in control of when the buffer gets overwritten.

    - there is a Posix/XSI and a glibc variant, making it sligthly
      inconvenient to used. This could be solved by a wrapper we implement.

    - thread-safe.

    - not guaranteed to be UTF-8.

- g_strerror()

    - convenient and safe to use. Also the buffer is never released for the
      remainder of the program.

    - passing untrusted error numbers to g_strerror() can result in a
      denial of service, as the internal buffer grows until out-of-memory.

    - thread-safe.

    - guaranteed to be UTF-8 (depending on locale).

Add our own wrapper nm_strerror_native(). It is:

    - convenient to use (returning a buffer that does not require
      management).

    - slightly dangerous as the buffer gets overwritten on the next call
      (like strerror()).

    - thread-safe.

    - guaranteed to be UTF-8 (depending on locale).

    - doesn't keep an unlimited cache of strings, unlike g_strerror().

You can't have it all. g_strerror() is leaking all generated error messages.
I think that is unacceptable, because it would mean we need to
keep track where our error numbers come from (and trust libraries we
use to only set a restricted set of known error numbers).
2019-02-12 08:50:28 +01:00
..
c-list shared/c-list: re-import from latest c-util/c-list 2019-02-06 07:54:19 +01:00
c-rbtree shared/c-rbtree: minor change to make sources identical to upsteam 2019-02-06 08:19:51 +01:00
c-siphash shared/c-siphash: re-import from latest c-util/c-siphash 2019-02-06 08:27:07 +01:00
n-acd shared/n-acd: minor change to make sources identical to upsteam 2019-02-06 08:40:42 +01:00
nm-utils shared: add nm_strerror_native() to replace strerror() and g_strerror() 2019-02-12 08:50:28 +01:00
systemd systemd/trivial: adjust naming of include guard define 2019-02-12 08:50:28 +01:00
meson.build build/meson: add intermediate shared/nm-utils base library 2019-02-05 09:53:24 +01:00
nm-common-macros.h manager: add connectivity-check-{available,enabled} properties. 2017-08-17 22:31:47 +02:00
nm-dbus-compat.h build: rename directory "include" to "shared" 2015-12-24 11:42:37 +01:00
nm-default.h systemd: move basic systemd library to shared/nm-utils 2019-01-02 17:07:13 +01:00
nm-dispatcher-api.h build: cleanup src/Makefile.am 2016-08-11 11:54:18 +02:00
nm-ethtool-utils.c shared: fix static array declaration for _by_name in "nm-ethtool-utils.c" 2019-02-08 20:14:50 +01:00
nm-ethtool-utils.h all/ethtool: add support for all currently supported kernel features 2018-08-10 10:38:19 +02:00
nm-meta-setting.c wifi-p2p: rename Wi-Fi P2P 2019-02-01 17:02:57 +01:00
nm-meta-setting.h wifi-p2p: rename Wi-Fi P2P 2019-02-01 17:02:57 +01:00
nm-test-libnm-utils.h tests: add nmtstc_auto_service_cleanup macro 2018-06-25 12:13:28 +02:00
nm-test-utils-impl.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-version-macros.h.in release: bump version to 1.15.0 (development) 2018-09-08 10:24:20 +02:00