summaryrefslogtreecommitdiff
path: root/src/udev/udev-builtin-usb_id.c
Commit message (Collapse)AuthorAgeFilesLines
* udev: make udev_builtin_run() take UdevEvent*Yu Watanabe2023-05-161-3/+2
| | | | No functional change, preparation for later commits.
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-191-1/+1
| | | | | | | | | | | | | | | | -1 was used everywhere, but -EBADF or -EBADFD started being used in various places. Let's make things consistent in the new style. Note that there are two candidates: EBADF 9 Bad file descriptor EBADFD 77 File descriptor in bad state Since we're initializating the fd, we're just assigning a value that means "no fd yet", so it's just a bad file descriptor, and the first errno fits better. If instead we had a valid file descriptor that became invalid because of some operation or state change, the other errno would fit better. In some places, initialization is dropped if unnecessary.
* udev: always create device symlinks for USB disksYu Watanabe2022-10-301-12/+43
| | | | | | | | | Previously, ata_id might not be able to retrieve attributes correctly, and properties from usb_id were used as a fallback. See issue #24921 and PR #24923. To keep backward compatibility, still we need to create symlinks based on USB serial. Fixes #25179.
* udev: always open with O_NOCTTYYu Watanabe2022-09-101-1/+1
| | | | | All files or device nodes opened here should not be console tty. Let's open it the flags for safety.
* tree-wide: Use correct format specifiersJan Janssen2022-08-301-1/+1
| | | | gcc will complain about all these with -Wformat-signedness.
* udev: pass rtnl to builtin commandsYu Watanabe2021-08-311-1/+1
|
* udev/builtins: inline iterator variables and other small modernizationsZbigniew Jędrzejewski-Szmek2021-08-071-3/+1
|
* udev: replace strtoul by safe_ato*David Tardon2021-06-241-10/+8
|
* udev: drop unnecessary libudev-util.h inclusionsYu Watanabe2020-12-161-1/+0
|
* udev: use encode_devnode_name() instead of udev_util_encode_string()Yu Watanabe2020-12-161-4/+5
| | | | | As udev_util_encode_string() is a simple wrapper of encode_devnode_name().
* udev: rename UTIL_LINE_SIZE -> UDEV_LINE_SIZE and friendsYu Watanabe2020-12-161-2/+2
| | | | This also moves them to udev-util.h
* udev: move util_replace_chars() to udev-util.cYu Watanabe2020-12-161-7/+7
|
* udev: move util_replace_whitespace() to udev-util.cYu Watanabe2020-12-161-7/+8
|
* license: GPL-2.0+ -> GPL-2.0-or-laterYu Watanabe2020-11-091-1/+1
|
* tree-wide: fix spelling of "fallback"Zbigniew Jędrzejewski-Szmek2020-08-201-1/+1
| | | | | | Similarly to "setup" vs. "set up", "fallback" is a noun, and "fall back" is the verb. (This is pretty clear when we construct a sentence in the present continous: "we are falling back" not "we are fallbacking").
* tree-wide: drop string.h when string-util.h or friends are includedYu Watanabe2019-11-041-1/+0
|
* udev: modernize udev-rules.cYu Watanabe2019-06-021-1/+1
| | | | | | | | | | | This does the following: - rename enum udev_builtin_cmd -> UdevBuiltinCmd - rename struct udev_builtin -> UdevBuiltin - move type definitions to udev-rules.h - move prototypes of functions defined in udev-rules.c to udev-rules.h - drop to use strbuf - propagate critical errors in applying rules, - drop limitation for number of tokens per line.
* tree-wide: replace explicit NULL checks with their shorter variantsFrantisek Sumsal2019-04-281-1/+1
| | | | Done by coccinelle/equals-null.cocci
* udev-builtin-usb_id: guard against overflow when reading descriptor dataZbigniew Jędrzejewski-Szmek2019-02-281-3/+8
| | | | | | | | | CID#996458. Coverity warns that we trust desc->bLength as read in the input data to adjust our position in the buffer. This value could be anything, leading to overflow. It's unlikely that the kernel feeds us invalid data, but let's me more careful. If any error is encountered, more logs are given.
* udev-builtin-usb_id: use strjoina to simplify codeZbigniew Jędrzejewski-Szmek2019-02-281-5/+3
|
* libudev-list: move libudev-list related definitions to libudev-list-internal.hYu Watanabe2018-11-201-1/+2
| | | | | This also rename libudev-private.h to libudev-util.h, and cleanups several unnecessary headers from udev.h and libudev-util.h
* udev-builtin-usb_id: update log messagesYu Watanabe2018-10-241-15/+16
|
* udev-builtin: propagate negative errnoYu Watanabe2018-10-231-24/+12
|
* udev: replace udev_device by sd_device from prototype of udev builtin commandsYu Watanabe2018-10-231-2/+1
|
* udev: replace udev_device by sd_device in udev-builtin-usb_id.cYu Watanabe2018-10-231-83/+94
|
* udev: make udev_builtin_add_property() take sd_device instead of udev_deviceYu Watanabe2018-10-231-15/+15
|
* udev-builtin: move definitions related to builtin commands to udev-builtin.hYu Watanabe2018-10-111-1/+2
|
* tree-wide: drop empty lines in commentsYu Watanabe2018-07-231-2/+0
|
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-201-1/+0
| | | | | | | | 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
* Drop more license boilerplateZbigniew Jędrzejewski-Szmek2018-06-141-12/+0
| | | | | | | | $ 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.
* tree-wide: use proper unicode © instead of (C) where we canLennart Poettering2018-06-141-1/+1
| | | | | | Let's use a proper unicode copyright symbol where we can, it's prettier. This important patch is very important.
* udev-builtin-usb_id: Check full range of size returned by read()Filipe Brandenburger2018-06-081-1/+1
| | | | | | | | | | | | | | | This shouldn't be necessary, since read() should never return a size larger than the size of the buffer passed in, but Coverity doesn't seem to understand that. We could possibly fix this with a model file for Coverity, but given changing the code is not that much of a biggie, let's just do that instead. Fixes CID 996458: Overflowed or truncated value (or a value computed from an overflowed or truncated value) `pos` used as array index. Tested: `ninja -C build/ test`, builds without warnings, test cases pass.
* Add SPDX license identifiers to source files under the GPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
|
* tree-wide: use IN_SET macro (#6977)Yu Watanabe2017-10-041-1/+1
|
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* udev: add emacs header lineZbigniew Jędrzejewski-Szmek2015-12-071-0/+2
| | | | | Otherwise emacs wants to use 2-space indentation and other attrocities.
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-251-0/+1
| | | | | There are more than enough to deserve their own .c file, hence move them over.
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-5/+6
| | | | | | | | | | | | | | 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.
* udev: add some assertsTom Gundersen2015-06-021-0/+2
| | | | Mostly for documentation purposes.
* udev-builtin-usb_id: fix inverted conditionZbigniew Jędrzejewski-Szmek2015-04-151-6/+6
| | | | | | Fix for 4beac74e69. Thanks, Ronny!
* udev-builtin-usb_id: simplificationZbigniew Jędrzejewski-Szmek2015-04-141-22/+14
|
* udev: downgrade a few warnings to debug messagesLennart Poettering2015-04-141-4/+2
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=89885
* udev: properly calculate size of remaining dataZbigniew Jędrzejewski-Szmek2015-03-131-11/+13
| | | | | | | The data comes from the kernel, so chances of it being garbled are low, but for correctness' sake, add the check. CID #996458.
* udev: use inttypes.h types wherever appropriateLennart Poettering2015-03-091-9/+9
|
* tree-wide: use _packed_ macro instead of raw gcc __attribute__Lennart Poettering2015-03-091-1/+1
|
* udevadm,..: make --help output of udev tools more like the output of the ↵Lennart Poettering2015-01-051-1/+1
| | | | various other tools
* udev: place opening { at the same line as the function declarationKay Sievers2014-07-291-10/+5
|
* doc: update punctuationJan Engelhardt2014-02-171-2/+2
| | | | Resolve spotted issues related to missing or extraneous commas, dashes.
* log: log_error() and friends add a newline after each line anyway, so avoid ↵Lennart Poettering2013-12-241-11/+11
| | | | including it in the log strings