Commit Graph

40 Commits

Author SHA1 Message Date
Daniel 14a6aee050 changed exit(4) to asynchronous-safe _exit(4) in signal handler sig_alrm 2018-07-26 14:47:38 +02:00
Yu Watanabe f330408d62 tree-wide: drop empty lines in comments 2018-07-23 08:44:24 +02:00
Lennart Poettering 810adae9e9 tree-wide: use proper unicode © instead of (C) where we can
Let's use a proper unicode copyright symbol where we can, it's prettier.

This important patch is very important.
2018-06-14 10:20:20 +02:00
Franck Bui 848e863acc basic/macros: rename noreturn into _noreturn_ (#8456)
"noreturn" is reserved and can be used in other header files we include:

  [   16s] In file included from /usr/include/gcrypt.h:30:0,
  [   16s]                  from ../src/journal/journal-file.h:26,
  [   16s]                  from ../src/journal/journal-vacuum.c:31:
  [   16s] /usr/include/gpg-error.h:1544:46: error: expected ‘,’ or ‘;’ before ‘)’ token
  [   16s]  void gpgrt_log_bug (const char *fmt, ...)    GPGRT_ATTR_NR_PRINTF(1,2);

Here we include grcrypt.h (which in turns include gpg-error.h) *after* we
"noreturn" was defined in macro.h.
2018-03-15 14:23:46 +09:00
Zbigniew Jędrzejewski-Szmek f810b631cd Revert "Replace use of snprintf with xsprintf"
This reverts commit a7419dbc59.

_All_ changes in that commit were wrong.

Fixes #8211.
2018-02-23 00:13:52 +01:00
Lennart Poettering 7b943bb7e3 tree-wide: use strv_isempty() instead of strv_length() == 0
It's a lot faster in many cases, since it's O(1) rather than O(n).
2017-11-29 12:41:08 +01:00
Zbigniew Jędrzejewski-Szmek ae34a10bac udev/collect: use _cleanup_ in one more place
This doesn't make the code pretty, but it at least makes it a tiny bit shorter.
2017-11-28 21:34:50 +01:00
Zbigniew Jędrzejewski-Szmek 3176084ff2 udev/collect: remove dead conditional
Coverity rightly says that 'word' is assigned to 'ptr', and 'word'
was assigned from 'ptr' (yikes) right after a non-null check.
2017-11-28 21:34:50 +01:00
Daniel Lockyer a7419dbc59 Replace use of snprintf with xsprintf 2017-11-24 10:36:04 +00:00
Zbigniew Jędrzejewski-Szmek e7145211c7 Add SPDX license identifiers to source files under the GPL 2017-11-19 19:08:15 +01:00
Andreas Rammhold 3742095b27
tree-wide: use IN_SET where possible
In addition to the changes from #6933 this handles cases that could be
matched with the included cocci file.
2017-10-02 13:09:54 +02:00
Zbigniew Jędrzejewski-Szmek 3cf3392364 udev/collect: remove now-unused struct udev 2017-05-07 22:49:12 -04:00
Zbigniew Jędrzejewski-Szmek b237a168df Rip out setting of the log level from udev_new and put it in a new function
This function is internal to systemd code, so external users of libudev
will not see those log messages. I think this is better. If we want to
allow that, the function could be put in libudev and exported.

v2: check that the string is more than one char before stripping quotes
2017-05-07 22:49:12 -04:00
Zbigniew Jędrzejewski-Szmek e68eedbbdc Revert some uses of xsprintf
This reverts some changes introduced in d054f0a4d4.
xsprintf should be used in cases where we calculated the right buffer
size by hand (using DECIMAL_STRING_MAX and such), and never in cases where
we are printing externally specified strings of arbitrary length.

Fixes #4534.
2016-11-02 22:36:29 -04:00
Daniel Mack d054f0a4d4 tree-wide: use xsprintf() where applicable
Also add a coccinelle receipt to help with such transitions.
2016-01-12 15:36:32 +01:00
Lennart Poettering b5efdb8af4 util-lib: split out allocation calls into alloc-util.[ch] 2015-10-27 13:45:53 +01:00
Lennart Poettering 07630cea1f util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.

This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.

Also touches a few unrelated include files.
2015-10-24 23:05:02 +02:00
Lennart Poettering 57255510c9 tree-wide: replace while(1) by for(;;) everywhere
Another Coccinelle script.
2015-09-09 14:59:53 +02:00
Thomas Hindoe Paaboel Andersen 2eec67acbb remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use.
2015-02-23 23:53:42 +01:00
Lennart Poettering 5ac0162c3a udevadm,..: make --help output of udev tools more like the output of the various other tools 2015-01-05 13:19:55 +01:00
Robert Milasan 257e968d8c udev: improve help/usage for some more programs 2015-01-01 14:38:21 -05:00
Thomas Hindoe Paaboel Andersen c4ef05484d use correct format types 2014-12-11 21:47:06 +01:00
Ronny Chevalier c9732bae8f udev: silence TOCTOU warning when creating a directory
CID#979416. There is no real race here to fix, but lets make coverity
happy and rework the code.

Note that we still fail if the directory is removed _after_ we ran
mkdir(), so the same race is still there. Coverity is complaining, though.
Rewrite the code to make it happy.

(David: rewrote the commit-message to note that this is not a race. If I'm
        wrong, blame me, not Ronny!)
2014-11-16 19:38:08 +01:00
Harald Hoyer 3f85ef0f05 s/commandline/command line/g 2014-11-06 15:34:18 +01:00
Lennart Poettering c8a202b7d4 everywhere: always use O_CLOEXEC where it makes sense 2014-02-13 14:59:56 +01:00
Shawn Landden 919ce0b7af _noreturn_ --> noreturn for C11 compat
also define noreturn w/o <stdnoreturn.h>
2013-12-17 21:51:24 +01:00
Daniel Buch f5f6d0e255 tree-wide usage of %m specifier instead of strerror(errno)
Also for log_error() except where a specific error is specified

e.g. errno ? strerror(errno) : "Some user specified message"
2013-11-26 21:07:46 +10:00
Zbigniew Jędrzejewski-Szmek ef89eef77e udev: fix two trivial memleaks in error path
Based-on-a-patch-by: Ian Stakenvicius <axs@gentoo.org>
2013-07-19 09:57:04 -04:00
Lennart Poettering 2852ae2134 udev: no need to output OOM, if we call log_oom() anyway 2013-03-22 21:05:42 +01:00
Zbigniew Jędrzejewski-Szmek 7d56679902 udev/collect: avoid initalizing memory twice 2013-03-22 15:40:37 -04:00
Thomas Hindoe Paaboel Andersen 090be86534 use streq instead of strcmp 2013-02-13 18:14:20 +01:00
Kay Sievers d5a89d7dc1 udev: move string copy functions to shared/ 2013-01-09 19:06:46 +01:00
Robert Milasan 2cf598fe02 udev: collect - use snprintf() 2012-09-27 15:51:58 +02:00
Václav Pavlín cb32f0141e udev: check return value of write 2012-09-23 14:24:43 +02:00
Václav Pavlín 8dc8ef598d udev: check malloc return in collect/collect.c
Returns from no memory checks updated with log_oom call
2012-09-23 14:24:43 +02:00
Shawn Landden 669241a076 use "Out of memory." consistantly (or with "\n")
glibc/glib both use "out of memory" consistantly so maybe we should
consider that instead of this.

Eliminates one string out of a number of binaries. Also fixes extra newline
in udev/scsi_id
2012-07-25 11:23:57 +02:00
Zbigniew Jędrzejewski-Szmek d91b8841d7 collect, keymap, systemctl: use _noreturn_ 2012-07-22 23:53:48 +02:00
Lucas De Marchi b27ee00bf5 udev: use container_of() macro 2012-04-29 19:15:08 +02:00
Kay Sievers 6ada823a9a udev: remove configuration options for /dev, /sys, /run directories 2012-04-16 19:20:57 +02:00
Kay Sievers 3e2147858f move imported udev into place 2012-04-04 05:05:07 +02:00
Renamed from src/udev/src/collect/collect.c (Browse further)