Commit Graph

10539 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
b5a7205f6e path: make the check for unsupported name_to_handle_at symmetric
If child supports, but the parent does not, or when the child does
not support, but the parent does, assume the child is a mount point.

Only if neither supports use the fallback.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-20 10:26:02 -05:00
Umut Tezduyar Lindskog
a2092eadcc path: follow symbolic link for parent path (2)
c0e57ba9e22ee937722958d8b912ade2a37f206d fixed the fallback path.
We should do the same for name_to_handle_at().

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-20 10:21:48 -05:00
Umut Tezduyar Lindskog
691bd2810b path: follow symbolic link for parent path
[zj: When we lstat the target path, symlinks above the last component
     will be followed by both stat and lstat. So when we look at the
     parent, we should follow symlinks.]

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-20 10:11:13 -05:00
Tom Gundersen
0ec88a3573 shared: strv - add strv_clear()
This frees the elements of the strv without freeing the strv itself.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-20 10:08:23 -05:00
Tom Gundersen
8170dcd369 shared: path-util - memory leak
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-20 10:05:27 -05:00
Susant Sahani
853a86e6a9 fix compiler warning
src/shared/utf8.c:268:13: warning: unused variable 'd'
[-Wunused-variable]
         int d;
2014-12-20 10:04:48 -05:00
Anthony G. Basile
c74cee5a9b src/shared/util.c: fix tempfn_xxxxxx()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-20 10:00:36 -05:00
Michal Schmidt
4ccd9baa59 configure.ac: add a generic --enable-debug, replace --enable-hashmap-debug
There will be more debugging options later.
 --enable-debug will enable them all.
 --enable-debug=hashmap will enable only hashmap debugging.

Also rename the C #define to ENABLE_DEBUG_* pattern.

NOTE: We add the debugging code to hashmap.{c,h} but do not
add the option in configure.ac.  We may do so at a later time.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-20 09:25:37 -05:00
Lennart Poettering
3f006fb44d src/shared/utf8.c: follow upstream adding utf8_encode_unichar()
This is part of upstream's e7eebcfc42f00aa481ef31abc8e7e243c16f5b2c
in which they add a minimal JSON tokenizer.  We don't add that but
update utf8 stuff from that commit to follow upstream more closely.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-20 09:19:11 -05:00
Michal Schmidt
87c9d285d2 shared/hashmap.h: fix comment
An early version used underscore prefixes for internal functions, but
the current version uses the prefix "internal_".

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-20 09:12:48 -05:00
Lennart Poettering
b0c70c543d src/shared/util.c: follow upstream on tempfn_xxxxxx()
Upstream change the behaviour of tempfn_xxxxxx() to make
the following work:

    # systemd-nspawn -xb -D / -M foobar

in commit c4e34a612c81266773cf8358cb38a43d2e43474e.  We
have no reason not to follow that change even though
eudev has nothing to do with nspawn.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-20 09:09:07 -05:00
Lennart Poettering
12586b6a8a util: minor simplification for loop_write() and loop_read()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-20 08:58:04 -05:00
Lennart Poettering
c26b217d91 util: when using basename() for creating temporary files, verify the resulting name is actually valid
Also, rename filename_is_safe() to filename_is_valid(), since it
actually does a full validation for what the kernel will accept as file
name, it's not just a heuristic.

NOTE: eudev doesn't have filename_is_safe() -- AGB

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-20 08:50:52 -05:00
Lennart Poettering
6b16cd5fed path-util: no need to check whether p is absolute twice
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-17 14:47:29 -05:00
Gabriel de Perthuis
c93ec252df blkid: Warn when rejecting a superblock with a bad csum
Bump libblkid requirement from 2.20 to 2.24.
util-linux 2.25 is actually required since fdbbad981cc5da8bb4ed7e9b6646e7a114745ec5

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-17 14:37:25 -05:00
Lennart Poettering
411ec4713b udev-builtin-btrfs: properly initialize ioctl struct to zeroes
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-17 14:32:39 -05:00
Thomas Hindoe Paaboel Andersen
fdb139feed use correct format types
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-17 14:28:47 -05:00
Marc Schmitzer
c01838a8db hwdb: add Lenovo 3000 N200 special key
https://bugs.freedesktop.org/show_bug.cgi?id=87377

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-17 14:23:47 -05:00
Peter Hutterer
cef254435c hwdb: Logitech MX1000, another Lenovo USB mouse
Provided by Benjamin Bellec

https://bugs.freedesktop.org/show_bug.cgi?id=87343

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-17 14:22:46 -05:00
Peter Hutterer
4255a0267f hwdb: more an entry for the MS Sculpt Ergonomic
Note that the MS receivers likely work like the Logitech ones, i.e. all
devices connected show up with the same vid/pid/name. Full evidence remains to
be gathered.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-17 14:22:04 -05:00
Daniel Mack
6701bca683 hwdb: fix ordering
We sort by default DPI, not the first one in the list.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-17 14:21:26 -05:00
Daniel Mack
1e40ba9756 hwdb: Logitech G400s
Provided by Peter Hutterer:

  https://bugs.freedesktop.org/show_bug.cgi?id=87332

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-17 14:20:46 -05:00
Harald Hoyer
0c0e1571b8 hwdb: Logitech MX 518
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-17 14:19:39 -05:00
Zbigniew Jędrzejewski-Szmek
b0c9fe1f49 hwdb: add more mice
https://bugs.freedesktop.org/show_bug.cgi?id=87271

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-17 14:18:56 -05:00
Zbigniew Jędrzejewski-Szmek
b3943faca5 hwdb: sort mice by brand,type,dpi,frequency
This way entries from the same brand with the same dpi and frequency
can be coalesced. It is also visually easier to find the right DPI
than order hexadecimal identifiers.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-17 14:17:58 -05:00
Marcel Holtmann
260e4b3a87 hwdb: Update database of Bluetooth company identifiers
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-17 14:14:49 -05:00
Lennart Poettering
11d61581aa core: unify how we iterate over inotify events
Let's add some syntactic sugar for iterating through inotify events, and
use it everywhere.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-11 13:45:16 -05:00
Torstein Husebø
96ed47b845 treewide: correct spacing near eol in code comments
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-11 13:33:10 -05:00
Torstein Husebø
9dca886fc2 hwdb: fix typo
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-11 11:18:25 -05:00
Lennart Poettering
94991570b1 hwdb: add two more mice to the DPI database
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-11 11:17:24 -05:00
Lennart Poettering
3f67592ea1 hwdb: add another Logitech mouse (M-BZ96C)
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-11 11:16:38 -05:00
Lennart Poettering
c1a53aba66 hwdb: add DPI data for M325 mouse
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-11 11:16:04 -05:00
Lennart Poettering
aa7b989905 hwdb: update PCI, USB, OUI databases
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-11 11:15:20 -05:00
Peter Hutterer
16e3cb106e hwdb: add more mouse DPI entries
Plus a note for Logitech devices using the unified receiver: these devices
include their wireless PID in the name, the usb PID/VID is the same for all.
In kernel 3.19 the actual model number will be the name, but the patches are
still a bit in flux at this point. In the future each device will need two
entries for pre+3.19 and 3.19.

https://bugs.freedesktop.org/show_bug.cgi?id=87037
https://bugs.freedesktop.org/show_bug.cgi?id=87072
https://bugs.freedesktop.org/show_bug.cgi?id=87162

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-11 11:14:53 -05:00
Lennart Poettering
f31810b038 smack-util: remove warning when building without SMACK support
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-04 17:38:11 -05:00
Michal Sekletar
a2e46b539b selinux: figure out selinux context applied on exec() before closing all fds
We need original socket_fd around otherwise mac_selinux_get_child_mls_label
fails with -EINVAL return code. Also don't call setexeccon twice but rather pass
context value of SELinuxContext option as an extra argument.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-04 17:37:10 -05:00
Thomas Hindoe Paaboel Andersen
a0d05ead08 util: don't shadow variable
environ is already defined in unistd.h

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-04 17:31:07 -05:00
Maurizio Lombardi
5bdf5509a0 udevd: SAS: use SAS addr + PHY id in by-path whenever possible.
This patch changes the naming scheme for sas disks. The original names used
disk's sas address and lun, the new scheme uses sas address of the
nearest expander (if available) and a phy id of the used connection.
If no expander is used, the phy id of hba phy is used.
Note that names that refer to RAID or other abstract devices are
unchanged.

Name in raid configuration:
hba_pci_address-sas-raid_sas_address-lunY-partZ

Name in expander bare disk configuration:
hba_pci_address-sas-expander_sas_address-phyX-lunY-partZ

Name format without expanders:
hba_pci_address-sas-phyX-lunY-partZ

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-04 17:02:20 -05:00
Lennart Poettering
1914270962 libudev: set errno properly in all error conditions of udev_device_new_from_syspath()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-04 16:44:56 -05:00
Marcel Holtmann
f8dfb6283d hwdb: Update database of Bluetooth company identifiers
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-04 16:39:18 -05:00
Lennart Poettering
7057e3da01 udev: strings in C are NUL-terminated anyway, no need to add a second NUL...
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-01 19:47:08 -05:00
Tom Gundersen
27c0fc5c98 udev: rules - ignore the lack of trailing newline
Also accept '\r' as newline character.

This dropps warnings of the type:

  invalid key/value pair in file /usr/lib/udev/rules.d/40-usb-media-players.rules
  on line 26, starting at character 25 ('')

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-01 19:46:05 -05:00
Tom Gundersen
b3a572ddf5 udev: rules - print the first invalid character
The current code would print the character following the first invalid
character.

Given an udev rules-file without a trailing newline we would otherwise print
garbage:

  invalid key/value pair in file /usr/lib/udev/rules.d/40-usb-media-players.rules
  on line 26, starting at character 25 ('m')

This is now changed to print

  invalid key/value pair in file /usr/lib/udev/rules.d/40-usb-media-players.rules
  on line 26, starting at character 25 ('')

(still not very good as printing \0 just gives the empty string)

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-01 19:43:58 -05:00
Tom Gundersen
5cb9807847 udev: rules - modernise add_rule a bit
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-01 19:42:39 -05:00
Peter Hutterer
ed19623f62 udevadm hwdb: discard extra leading whitespaces in hwdb
Currently a property in the form of
  FOO=bar
is stored as " FOO=bar", i.e. the property name contains a leading space.
That's quite hard to spot.

This patch discards all extra whitespaces but the first one which is required
by libudev's hwdb_add_property.

[zj: modify the check a bit]

https://bugs.freedesktop.org/show_bug.cgi?id=82311

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-01 19:40:18 -05:00
Ross Lagerwall
c0d8d523a6 cgroup-util: Don't send SIGCONT after SIGKILL
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-01 19:37:06 -05:00
Lennart Poettering
4e7269063d treewide: introduce UID_INVALID (and friends) as macro for (uid_t) -1
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-01 19:31:53 -05:00
Michal Schmidt
f460aa149c treewide: another round of simplifications
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno
+ return simplifications".

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-01 13:13:40 -05:00
Michal Schmidt
761b969283 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.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-12-01 07:39:05 -05:00
Michal Schmidt
ed7c6787bd treewide: drop unnecessary trailing \n in log_*() calls
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-11-30 14:45:49 -05:00