Commit graph

60 commits

Author SHA1 Message Date
Yu Watanabe f330408d62 tree-wide: drop empty lines in comments 2018-07-23 08:44:24 +02:00
Zbigniew Jędrzejewski-Szmek d9b02e1697 tree-wide: drop copyright headers from frequent contributors
Fixes #9320.

for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do
  git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms'
done
2018-06-20 11:58:53 +02:00
Zbigniew Jędrzejewski-Szmek 50d1760d26 Drop more license boilerplate
$ git grep -e 'This program is free software' -l |grep -v LICENSE | \
  xargs perl -i -0pe 's/ \* This program.*?for more details.\s*\*\n( \* You should have.*licenses.>.\n)?//gms'

For some reason they were missed previously. All those files seem to
have proper SDPX tags.
2018-06-14 13:05:41 +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
Lennart Poettering 08c849815c label: rework label_fix() implementations (#8583)
This reworks the SELinux and SMACK label fixing calls in a number of
ways:

1. The two separate boolean arguments of these functions are converted
   into a flags type LabelFixFlags.

2. The operations are now implemented based on O_PATH. This should
   resolve TTOCTTOU races between determining the label for the file
   system object and applying it, as it it allows to pin the object
   while we are operating on it.

3. When changing a label fails we'll query the label previously set, and
   if matches what we want to set anyway we'll suppress the error.

Also, all calls to label_fix() are now (void)ified, when we ignore the
return values.

Fixes: #8566
2018-03-27 07:38:26 +02:00
Zbigniew Jędrzejewski-Szmek 87ac8d998f tree-wide: use "cannot" instead of "can not"
This is the usual spelling, and a bit shorter.
2018-02-08 10:34:52 +01:00
Lennart Poettering fbd0b64f44
tree-wide: make use of new STRLEN() macro everywhere (#7639)
Let's employ coccinelle to do this for us.

Follow-up for #7625.
2017-12-14 19:02:29 +01:00
Zbigniew Jędrzejewski-Szmek c67f84b025 Add a helper for /dev/block/major:minor paths 2017-11-30 12:59:23 +01:00
Zbigniew Jędrzejewski-Szmek e7145211c7 Add SPDX license identifiers to source files under the GPL 2017-11-19 19:08:15 +01:00
Yu Watanabe 4c70109600 tree-wide: use IN_SET macro (#6977) 2017-10-04 16:01:32 +02:00
Reverend Homer 8fb3f00997 tree-wide: replace all readdir cycles with FOREACH_DIRENT{,_ALL} (#4853) 2016-12-09 10:04:30 +01:00
Zbigniew Jędrzejewski-Szmek f97b34a629 Rename formats-util.h to format-util.h
We don't have plural in the name of any other -util files and this
inconsistency trips me up every time I try to type this file name
from memory. "formats-util" is even hard to pronounce.
2016-11-07 10:15:08 -05:00
Zbigniew Jędrzejewski-Szmek e02c613560 udev/udev-watch: calculate the real buffer sizes needed 2016-11-02 22:36:43 -04:00
Daniel Mack b26fa1a2fb tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file.
2016-02-10 13:41:57 +01: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
Zbigniew Jędrzejewski-Szmek 3f65d73149 udev: add emacs header line
Otherwise emacs wants to use 2-space indentation and other
attrocities.
2015-12-07 00:45:08 -05:00
Michal Schmidt e1427b138f treewide: apply errno.cocci
with small manual cleanups for style.
2015-11-09 20:01:06 +01:00
Lennart Poettering f4f15635ec util-lib: move a number of fs operations into fs-util.[ch] 2015-10-27 13:25:56 +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
WaLyong Cho 5ab58c2091 smack-util: revise smack-util apis and add read smack attr apis
- Add smack xattr lookup table
- Unify all of mac_smack_apply_xxx{_fd}() to mac_smack_apply() and
  mac_smack_apply_fd().
- Add smack xattr read apis similar with apply apis as
  mac_smack_read{_fd}().
2015-08-04 21:11:19 +09:00
Ronny Chevalier 6482f6269c shared: add formats-util.h 2015-04-10 23:54:48 +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
Zbigniew Jędrzejewski-Szmek 1fa2f38f0f Assorted format fixes
Types used for pids and uids in various interfaces are unpredictable.
Too bad.
2015-01-22 01:14:52 -05:00
Lennart Poettering d7b8eec7dc tmpfiles: add new line type 'v' for creating btrfs subvolumes 2014-12-28 02:08:40 +01:00
Michal Schmidt 56f64d9576 treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful
value, so we might as well use log_*_errno to have ERRNO= logged.

Using:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/'

Plus some whitespace, linewrap, and indent adjustments.
2014-11-28 19:49:27 +01:00
Michal Schmidt da927ba997 treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values.
2014-11-28 13:29:21 +01:00
Michal Schmidt 0a1beeb642 treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all
low-level logging calls and intrdouce log_error_errno() as log calls
that take error numbers", use sed to convert the simple cases to use
the new macros:

find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/'

Multi-line log_*() invocations are not covered.
And we also should add log_unit_*_errno().
2014-11-28 12:04:41 +01:00
WaLyong Cho 2ec62d8e84 udev: do NOT re-label smack
If selinux is disabled and smack is only enabled, smack label is
relable-ed by label_fix. To avoid, make only be labeled for selinux.
2014-10-24 13:56:24 +02:00
Lennart Poettering ecabcf8b6e selinux: clean up selinux label function naming 2014-10-23 21:36:56 +02:00
Lennart Poettering d53e386db6 smack: rework smack APIs a bit
a) always return negative errno error codes
b) always become a noop if smack is off
c) always take a NULL label as a request to remove it
2014-10-23 21:36:56 +02:00
Lennart Poettering c80d766c80 mac: rename all calls that apply a label mac_{selinux|smack}_apply_xyz(), and all that reset it to defaults mac_{selinux|smack}_fix()
Let's clean up the naming schemes a bit and use the same one for SMACK
and for SELINUX.
2014-10-23 21:36:56 +02:00
WaLyong Cho cc56fafeeb mac: rename apis with mac_{selinux/smack}_ prefix 2014-10-23 17:13:15 +02:00
Tom Gundersen 543afdc63c udev: node - warn if chmod/chown fails
No functional change, just log the warning.

Fonud by Coverity. Fixes CID #1237544.
2014-09-18 19:22:09 +02:00
Tom Gundersen 37d522746b libudev: util - drop util_delete_path()
Use rmdir_parents() from src/shared instead.
2014-09-16 12:12:56 +02:00
Kay Sievers 9ec6e95b04 udev: place opening { at the same line as the function declaration 2014-07-29 15:49:25 +02:00
Lennart Poettering 9f6445e34a log: log_error() and friends add a newline after each line anyway, so avoid including it in the log strings 2013-12-24 16:39:37 +01:00
Kay Sievers 9a4e038c15 smack: minimize ifdef use, and move all labeling to smack-util.c 2013-10-11 10:16:41 +02:00
Lennart Poettering d682b3a7e7 security: rework selinux, smack, ima, apparmor detection logic
Always cache the results, and bypass low-level security calls when the
respective subsystem is not enabled.
2013-10-10 16:35:44 +02:00
Kay Sievers 463b5dbb0d udev: add SECLABEL{selinux}= support 2013-10-09 17:31:41 +02:00
Kay Sievers b7e2b7641e udev: reset Linux Security Module labels if no custom rules are given 2013-10-09 04:26:41 +02:00
Kay Sievers c26547d612 udev: support custom Linux Security Module labels for device nodes 2013-10-08 02:23:24 +02:00
Thomas Hindoe Paaboel Andersen 090be86534 use streq instead of strcmp 2013-02-13 18:14:20 +01:00
Kay Sievers 38d70045d1 udev: use unique names for temporary files created in /dev
On Tue, Feb 12, 2013 at 2:18 PM, Robert Milasan <rmilasan@suse.com> wrote:
> Under some circumstances udev mixed with multipath fails:
>
> udevd-work[1376]:
> symlink(../../sdk, /dev/disk/by-id/scsi-36005076305ffc0670000000000002842.udev-tmp)
> failed: File exists udevd-work[1432]:
> rename(/dev/disk/by-id/scsi-36005076305ffc0850000000000000a88.udev-tmp, /dev/disk/by-id/scsi-36005076305ffc0850000000000000a88)
> failed: No such file or directory
>
> This is non-fatal, but there is no point of created the symlink or
> renaming the symlink if it already exists.
>
> Reference: https://bugzilla.novell.com/show_bug.cgi?id=791503

It looke like this now:
  stat("/dev/disk/by-id", {st_mode=S_IFDIR|0755, st_size=80, ...}) = 0
  symlink("../../sda", "/dev/disk/by-id/ata-INTEL...N.tmp-b8:0") = 0
  rename("/dev/disk/by-id/ata-INTEL...N.tmp-b8:0", "/dev/disk/by-id/ata-INTEL...N") = 0
2013-02-12 16:08:14 +01:00
Kay Sievers 22582bb2cb udev: set default rules permissions only at "add" events 2013-01-27 21:46:36 +01:00
Kay Sievers d5a89d7dc1 udev: move string copy functions to shared/ 2013-01-09 19:06:46 +01:00
Kay Sievers 48a849ee17 udev: set device node permissions only at "add" events 2013-01-04 16:15:46 +01:00
Kay Sievers 1298001ec5 use the same email address everywhere 2012-11-12 19:47:43 +01:00
Kay Sievers 8a1733871f udev: remove SYMLINK "unique" option 2012-10-08 21:54:39 +02:00
Kay Sievers dbf61afb29 udev: export udev_device_new_from_device_id() 2012-08-10 19:56:57 +02:00
Kay Sievers 4cb72937d3 udev: get rid of TEST_PREFIX and use unshare() to fake /sys, /dev, /run 2012-07-15 22:10:46 +02:00