summaryrefslogtreecommitdiff
path: root/src/udev
AgeCommit message (Collapse)Author
2015-09-09tree-wide: replace while(1) by for(;;) everywhereLennart Poettering
Another Coccinelle script.
2015-09-09tree-wide: update empty-if coccinelle script to cover empty-while and moreLennart Poettering
Let's also clean up single-line while and for blocks.
2015-09-09Merge pull request #1207 from poettering/coccinelle-fixesDaniel Mack
Coccinelle fixes
2015-09-09tree-wide: drop {} from one-line if blocksLennart Poettering
Patch via coccinelle.
2015-09-09tree-wide: make use of log_error_errno() return valueLennart Poettering
Turns this: r = -errno; log_error_errno(errno, "foo"); into this: r = log_error_errno(errno, "foo"); and this: r = log_error_errno(errno, "foo"); return r; into this: return log_error_errno(errno, "foo");
2015-09-09tree-wide: drop redundant if checks before safe_close()Lennart Poettering
Replace this: if (fd >= 0) safe_close(fd); by this: safe_close(fd);
2015-09-09tree-wide: make more code use safe_close()Lennart Poettering
Replace this: close(fd); fd = -1; write this: fd = safe_close(fd);
2015-09-09tree-wide: use coccinelle to patch a lot of code to use mfree()Lennart Poettering
This replaces this: free(p); p = NULL; by this: p = mfree(p); Change generated using coccinelle. Semantic patch is added to the sources.
2015-09-08udev: build by-path identifiers for ATA devices.David Milburn
/dev/disk/by-path total 0 lrwxrwxrwx. 1 root root 9 Sep 4 10:02 pci-0000:00:1f.2-ata-2 -> ../../sr0 lrwxrwxrwx. 1 root root 9 Sep 4 10:02 pci-0000:00:1f.2-ata-3 -> ../../sdd lrwxrwxrwx. 1 root root 10 Sep 4 10:02 pci-0000:00:1f.2-ata-3-part1 -> ../../sdd1 lrwxrwxrwx. 1 root root 10 Sep 4 10:02 pci-0000:00:1f.2-ata-3-part2 -> ../../sdd2 lrwxrwxrwx. 1 root root 10 Sep 4 10:02 pci-0000:00:1f.2-ata-3-part3 -> ../../sdd3 lrwxrwxrwx. 1 root root 9 Sep 4 10:02 pci-0000:03:00.0-ata-4 -> ../../sda lrwxrwxrwx. 1 root root 10 Sep 4 10:02 pci-0000:03:00.0-ata-4-part1 -> ../../sda1 lrwxrwxrwx. 1 root root 10 Sep 4 10:02 pci-0000:03:00.0-ata-4-part2 -> ../../sda2 lrwxrwxrwx. 1 root root 9 Sep 4 10:02 pci-0000:08:00.0-ata-1 -> ../../sdc lrwxrwxrwx. 1 root root 10 Sep 4 10:02 pci-0000:08:00.0-ata-1-part1 -> ../../sdc1 lrwxrwxrwx. 1 root root 10 Sep 4 10:02 pci-0000:08:00.0-ata-1-part2 -> ../../sdc2
2015-09-08sd-login: fix sd_seat_get_active() to return ENODATAsystemd/v226David Herrmann
This seems to be an oversight from: 707b66c66381c899d7ef640e158ffdd5bcff4deb We have to return ENODATA instead of ENOENT if a requested entry is non-present. Also fix the call-site in udev to check for these errors.
2015-09-03udev: ignore ENOEXEC from cgroup lookupDavid Herrmann
The recent cgroup-rework changed the error code for un-mounted cgroupfs to ENOEXEC. Make sure udev ignores it just like ENOENT and does not spill warnings on the screen.
2015-09-02udev: net_id - support predictable ifnames on virtio busesTom Gundersen
Virtio buses are undeterministically enumerated, so we cannot use them as a basis for deterministic naming (see bf81e792f3c0). However, we are guaranteed that there is only ever one virtio bus for every parent device, so we can simply skip over the virtio buses when naming the devices.
2015-08-27udev: control - add FIXME comment to remove work-aroundKay Sievers
2015-08-17Bug #944: Deletion of unnecessary checks before calls of the function "free"Markus Elfring
The function "free" is documented in the way that no action shall occur for a passed null pointer. It is therefore not needed that a function caller repeats a corresponding check. http://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first This issue was fixed by using the software Coccinelle 1.0.1.
2015-08-12Merge pull request #939 from karelzak/smatchTom Gundersen
treewide: trivial issues detected by smatch
2015-08-11gpt-auto-generator: apply partition-type flags only to specific partition-typesKay Sievers
The partition-type flags are defined independently for every partition-type. Apply them only to the types where they are defined, and not to the ESP, which does not appear to share the same set of flags. https://github.com/systemd/systemd/issues/920
2015-08-06udev: variable dereferenced before check 'cmsg'Karel Zak
2015-08-06Merge pull request #883 from phomes/bool_vs_error_codesDaniel Mack
tree-wide: do not return error codes as bool
2015-08-06tree-wide: do not return error codes as boolThomas Hindoe Paaboel Andersen
2015-08-06tree-wide: fix indentationThomas Hindoe Paaboel Andersen
2015-08-05udev: uaccess - do not log error when device node disappearsKay Sievers
https://github.com/systemd/systemd/issues/875
2015-08-04smack-util: revise smack-util apis and add read smack attr apisWaLyong Cho
- 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-03sd-event: make sure sd_event_now() cannot failLennart Poettering
Previously, if the event loop never ran before sd_event_now() would fail. With this change it will instead fall back to invoking now(). This way, the function cannot fail anymore, except for programming error when invoking it with wrong parameters. This takes into account the fact that many callers did not handle the error condition correctly, and if the callers did, then they kept simply invoking now() as fall back on their own. Hence let's shorten the code using this call, and make things more robust, and let's just fall back to now() internally. Whether now() is used or the cache timestamp may still be detected via the return value of sd_event_now(). If > 0 is returned, then the fall back to now() was used, if == 0 is returned, then the cached value was returned. This patch also simplifies many of the invocations of sd_event_now(): the manual fall back to now() can be removed. Also, in cases where the call is invoked withing void functions we can now protect the invocation via assert_se(), acknowledging the fact that the call cannot fail anymore except for programming errors with the parameters. This change is inspired by #841.
2015-07-31tree-wide: introduce mfree()David Herrmann
Pretty trivial helper which wraps free() but returns NULL, so we can simplify this: free(foobar); foobar = NULL; to this: foobar = mfree(foobar);
2015-07-30tree-wide: use free_and_strdup()Daniel Mack
Use free_and_strdup() where appropriate and replace equivalent, open-coded versions.
2015-07-28udev: Fix udev_builtin_run_once()Daniel Mack
Honour the boolean return value type. This was an oversight in f89d10ae4.
2015-07-28udev: check more builtins[] pointers before dereferencingDaniel Mack
Fix some more locations where pointers from builtins[] are dereferenced before checking. Related to 8cacf69b1.
2015-07-28Merge pull request #756 from ldzhong/fixDaniel Mack
udev: avoid coredump when initializing udev builtins
2015-07-28udev: avoid coredump when initializing udev builtinsLidong Zhong
If one of the macros(HAVE_BLKID/HAVE_KMOD/HAVE_ACL) is not defined, there will be a coredump
2015-07-25ata_id: remove unused union memberThomas Hindoe Paaboel Andersen
The last use of octa was removed in 01f61d331bb5038f0c877ac03c54333328b6ea28
2015-07-24tree-wide: do not use _cleanup_free_ on const pointersDaniel Mack
free() cannot be used with const pointers. However, our _cleanup_free_ handler features cast logic that hides that qualifier, so we don't get a warning.
2015-07-24Merge pull request #702 from ldzhong/fixDaniel Mack
udev: fix parameter process
2015-07-24udev: fix parameter processLidong Zhong
2015-07-22ata_id: unreverse WWN identifierZbigniew Jędrzejewski-Szmek
An endianness conversion was lost in 6024a6e302bad6bcf073fa84a41a6123305dc845. Restore it. Now ata_id and scsi_id output match. https://bugzilla.redhat.com/show_bug.cgi?id=1227503
2015-07-21udev: unify reporting of invalid cmdline keysMichal Schmidt
This way it does not need distinct string literals and it also preserves the "rd." prefix.
2015-07-21udev: fix crash with invalid udev.log-priorityMichal Schmidt
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1245293
2015-07-06tree-wide: fix write_string_file() user that should not create filesDaniel Mack
The latest consolidation cleanup of write_string_file() revealed some users of that helper which should have used write_string_file_no_create() in the past but didn't. Basically, all existing users that write to files in /sys and /proc should not expect to write to a file which is not yet existant.
2015-07-06fileio: consolidate write_string_file*()Daniel Mack
Merge write_string_file(), write_string_file_no_create() and write_string_file_atomic() into write_string_file() and provide a flags mask that allows combinations of atomic writing, newline appending and automatic file creation. Change all users accordingly.
2015-07-01Merge pull request #463 from dvdhrm/udev-runDaniel Mack
udev: destroy manager before cleaning environment
2015-07-01udev: destroy manager before cleaning environmentDavid Herrmann
Due to our _cleanup_ usage for the udev manager, it will be destroyed after the "exit:" label has finished. Therefore, it is the last destruction done in main(). This has two side-effects: - mac_selinux is destroyed before the udev manager is, possible causing use-after-free if the manager-cleanup accesses selinux data - log_close() is called *before* the manager is destroyed, possibly re-opening the log if you use --debug (and thus not re-applying the --debug option) Avoid this by moving the manager-handling into a new function called run(). This function will be left before we enter the "exit:" label in main(), hence, the manager object will be destroyed early.
2015-07-01udevd: force --debug mode to stderrKay Sievers
https://github.com/systemd/systemd/issues/462
2015-06-30Merge pull request #411 from teg/udev-simplify-exec-envpKay Sievers
udev: event - simplify udev_event_spawn() logic
2015-06-30udev: remove WAIT_FOR keyKay Sievers
This facility was never a proper solution, but only papered over real bugs in the kernel. There are no known sysfs "timing bugs" since a long time.
2015-06-29udev: event - simplify udev_event_spawn() logicTom Gundersen
Push the extraction of the envp + argv as close as possible to their use, to avoid code duplication. As a sideeffect fix logging when delaing execution.
2015-06-27udev: Remove accelerometer helperBastien Nocera
It's moved to the iio-sensor-proxy D-Bus service.
2015-06-24ata_id: unbotch format specifierJan Engelhardt
Commit v218-247-g11c6f69 broke the output of the utility. "%1$" PRIu64 "x" expands to "%1$lux", essentially "%lux", which shows the problem. u and x cannot be combined, u wins as the type character, and x gets emitted verbatim to stdout. References: https://bugzilla.redhat.com/show_bug.cgi?id=1227503
2015-06-23udevadm: trigger - check return valuesTom Gundersen
Fixes CID#1296243.
2015-06-23udev: worker - check return value of udev_monitor_enable_receiving()Tom Gundersen
Fixes CID#1297430.
2015-06-23udev: event - check return code of dup2()Tom Gundersen
This fixes CID#1304688.
2015-06-23udev: bulitin-hwdb - fix memory leakTom Gundersen
This fixes CID#1292782.