summaryrefslogtreecommitdiff
path: root/src/libudev/libudev-enumerate.c
AgeCommit message (Collapse)Author
2015-03-27Remove hardcoded path /run and configure using --with-rootrundir=David Cortarello
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-02-21everywhere: make use of new0() and macro() macros, and stop using perror()Lennart Poettering
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-01-09libudev: always return NULL in _unref() APIsLennart Poettering
Returning anything else but NULL would suggest the caller's reference might still be valid, but it isn't, because the caller just invoked _unref() after all. This turns the return value into a typesafe shortcut that allows unreffing and resetting a reference in one line. In contrast to solutions for this which take a pointer to a pointer to accomplish the same this solution is just syntactic sugar the developer can make use of but doesn't have to, and this is particularly useful when immediately unreffing objects returned by function calls. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-01-09Never call qsort on potentially NULL arraysZbigniew Jędrzejewski-Szmek
This extends 62678ded 'efi: never call qsort on potentially NULL arrays' to all other places where qsort is used and it is not obvious that the count is non-zero. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-09-14libudev: fix move_later comparisoneudev/v1.3Lukas Nykryn
At the beginning move_later is set to -1, but it is set to different value only if expression !move_later is true.
2013-09-10libudev: enumerate - do not try to match against an empty subsystemKay Sievers
2013-09-10libudev: enumerate: fix NULL-deref for subsystem-matchesDavid Herrmann
udev_device_get_subsystem() may return NULL if no subsystem could be figured out by libudev. This might be due to OOM or if the device disconnected between the udev_device_new() call and udev_device_get_subsystem(). Therefore, we need to handle subsystem==NULL safely. Instead of testing for it in each helper, we treat subsystem==NULL as empty subsystem in match_subsystem(). Backtrace of udev_enumerate with an input-device disconnecting in exactly this time-frame: (gdb) bt #0 0x00007ffff569dc24 in strnlen () from /usr/lib/libc.so.6 #1 0x00007ffff56d9e04 in fnmatch@@GLIBC_2.2.5 () from /usr/lib/libc.so.6 #2 0x00007ffff5beb83d in match_subsystem (udev_enumerate=0x7a05f0, subsystem=0x0) at src/libudev/libudev-enumerate.c:727 #3 0x00007ffff5bebb30 in parent_add_child (enumerate=enumerate@entry=0x7a05f0, path=<optimized out>) at src/libudev/libudev-enumerate.c:834 #4 0x00007ffff5bebc3f in parent_crawl_children (enumerate=enumerate@entry=0x7a05f0, path=0x7a56b0 "/sys/devices/<shortened>/input/input97", maxdepth=maxdepth@entry=254) at src/libudev/libudev-enumerate.c:866 #5 0x00007ffff5bebc54 in parent_crawl_children (enumerate=enumerate@entry=0x7a05f0, path=0x79e8c0 "/sys/devices/<shortened>/input", maxdepth=maxdepth@entry=255) at src/libudev/libudev-enumerate.c:868 #6 0x00007ffff5bebc54 in parent_crawl_children (enumerate=enumerate@entry=0x7a05f0, path=path@entry=0x753190 "/sys/devices/<shortened>", maxdepth=maxdepth@entry=256) at src/libudev/libudev-enumerate.c:868 #7 0x00007ffff5bec7df in scan_devices_children (enumerate=0x7a05f0) at src/libudev/libudev-enumerate.c:882 #8 udev_enumerate_scan_devices (udev_enumerate=udev_enumerate@entry=0x7a05f0) at src/libudev/libudev-enumerate.c:919 #9 0x00007ffff5df8777 in <random_caller> () at some/file.c:181
2013-09-10libudev: fix memleak when enumerating childsDavid Herrmann
We need to free udev-devices again if they don't match. Funny that no-one noticed it yet since valgrind is quite verbose about it. Fix it and free non-matching devices.
2013-09-10libudev-enumerate.c:udev_enumerate_get_list_entry() fixed possible stale pointerHarald Hoyer
If a realloc() happens in syspath_add(), the move_later pointer could point to an invalid memory region. Let move_later store the array index, instead of the pointer to the entry.
2013-07-07Import strxcpyx from upstreamAnthony G. Basile
This commit imports strxcpyx from upstream. This is upstream commit d5a89d7dc17a5ba5cf4fc71f82963c5c94a31c3d Note: there were also some very minor code cleanups to accelerometer.c: line 187 collect.c: lines 35, 140 libudev-device.c: line 780 libudev-hwdb.c: line 300 These are part of upstream commits: 507f22bd0172bff5e5d98145b1419bd472a2c57f 3cf7b686e6b29f78de0af5929602cae4482f6d49 67410e9f73a6cdd8453c78b966451b5151def14a Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-01-28Abort udev_enumerate_new if udev obj is nullIan Stakenvicius
https://bugs.freedesktop.org/show_bug.cgi?id=58289 systemd commit e68893075083a7461b1572233d23fdb23541d630 Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2012-11-12libudev: update copyright headersKay Sievers
2012-08-10udev: export udev_device_new_from_device_id()Kay Sievers
2012-05-15udev: update docs, NEWSKay Sievers
2012-05-15udev: libudev - bump soname, remove deprecated functions, introduce symbol ↵Kay Sievers
versions
2012-04-20docs: hook-up gtk-doc to 'make check'Kay Sievers
2012-04-16udev: use startswith() and streq()Kay Sievers
2012-04-16udev: remove configuration options for /dev, /sys, /run directoriesKay Sievers
2012-04-13udev: move libudev, gudev to src/; move gudev/docs/, udev/docs/ to to docs/Kay Sievers