Commit Graph

22 Commits

Author SHA1 Message Date
Thomas Hindoe Paaboel Andersen 756775814c tree-wide: do not return error codes as bool 2015-08-06 00:49:45 +02:00
Ronny Chevalier 3df3e884ae shared: add random-util.[ch] 2015-04-11 00:11:13 +02:00
Harald Hoyer cb80d06c74 cdrom_id: unroll and simplify data check loop
also removes this warning:

src/udev/cdrom_id/cdrom_id.c: In function ‘cd_media_info.isra.13’:
src/udev/cdrom_id/cdrom_id.c:612:12: warning: assuming signed overflow
does not occur when assuming that (X + c) >= X is always true
[-Wstrict-overflow]
 static int cd_media_info(struct udev *udev, int fd)
            ^
2015-03-27 14:57:38 +01:00
Robert Milasan 257e968d8c udev: improve help/usage for some more programs 2015-01-01 14:38:21 -05:00
Thomas Hindoe Paaboel Andersen c4ef05484d use correct format types 2014-12-11 21:47:06 +01:00
Kay Sievers 25e773eeb4 udev: switch to systemd logging functions 2014-11-13 13:12:57 +01:00
Lennart Poettering ef309a681f util: unify how we see srand() 2014-10-30 15:35:37 +01:00
Zbigniew Jędrzejewski-Szmek 3fcd09602c cdrom_id: do not attempt to read past end of buffer
CID #1238437
2014-10-27 22:30:43 -04:00
Lennart Poettering 5168f84a29 udev: never bypass our own logging framework and call vsyslog() directly from udev tools 2014-08-11 20:13:38 +02:00
Lukas Nykryn a14f149760 cdrom_id: use the old MMC fallback
https://bugzilla.redhat.com/show_bug.cgi?id=1038015
The problem seems to be that the your virtual DVD is emulating a really
old DVD device, and doing it kind of strangely.

> dracut:# /lib/udev/cdrom_id --debug /dev/sr0
> probing: '/dev/sr0'
> INQUIRY: [IMM     ][Virtual CD/DVD   ][0316]
> GET CONFIGURATION failed with SK=5h/ASC=24h/ACQ=00h

So your virtual drive rejects the GET CONFIGURATION command as illegal.

Other pre-MMC2 drives that don't accept this command usually return the
error
SK=5h,ASC=20h (invalid/unsupported command code), in which case cdrom_id
tries an older method, and then ID_CDROM_MEDIA_TRACK_COUNT_DATA gets set
and all the /dev/disk/by-label (etc) links get set up.

The virtual drive returns the error SK=5h,ASC=24h (invalid field in
Command Descriptor Block), which cdrom_id doesn't handle, so it gives up
and the links never get made.

The ideal solution would be to make the IMM to emulate a device that's
less than 15 years old, but I'm not going to hold my breath waiting for
that.

So probably cdrom_id should also use the old MMC fallback when the error
is SK=5h,ASC=24h, and then all of this would work as expected.

Suggested-by:Luca Miccini <lmiccini@redhat.com>
2014-02-27 11:12:04 +01:00
Lennart Poettering c8a202b7d4 everywhere: always use O_CLOEXEC where it makes sense 2014-02-13 14:59:56 +01:00
Greg KH 29804cc1e0 use memzero(foo, length); for all memset(foo, 0, length); calls
In trying to track down a stupid linker bug, I noticed a bunch of
memset() calls that should be using memzero() to make it more "obvious"
that the options are correct (i.e. 0 is not the length, but the data to
set).  So fix up all current calls to memset(foo, 0, length) to
memzero(foo, length).
2014-01-31 11:55:01 +01: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
Thomas Hindoe Paaboel Andersen 9091e686f4 Add more _printf_'s for format-nonliterals
Clang is a bit more strict wrt format-nonliterals:
http://clang.llvm.org/docs/LanguageExtensions.html#format-string-checking

Adding these extra printf attributes also makes gcc able to find more
problems. E.g. this patch uncovers a format issue in udev-builtin-path_id.c

Some parts looked intetional about breaking the format-nonliteral check.
I added some supression for warnings there.
2013-12-14 13:32:22 +01:00
Zbigniew Jędrzejewski-Szmek 24be982274 Remove or indent #define GNU_SOURCE
It is only needed in files designed to be usable in standalone
compilation. In those files the #ifdefinery is indented. When
compiling in-tree, GNU_SOURCE is always defined, so remove one
definition.
2013-03-11 18:03:13 -04:00
Harald Hoyer a0ec302b93 cdrom_id: add data track count for bad virtual drive implementations
/# /lib/udev/cdrom_id --debug /dev/sr0
probing: '/dev/sr0'
INQUIRY: [AMI     ][Virtual CDROM   ][1.00]
GET CONFIGURATION failed with SK=5h/ASC=20h/ACQ=00h
drive is pre-MMC2 and does not support 46h get configuration command
trying to work around the problem
READ DISC INFORMATION failed with SK=5h/ASC=20h/ACQ=00h
no current profile, but disc is present; assuming CD-ROM
READ TOC: len: 12, start track: 1, end track: 1
last track 1 starts at block 0
READ DISC INFORMATION failed with SK=5h/ASC=20h/ACQ=00h
ID_CDROM=1
ID_CDROM_MEDIA=1
ID_CDROM_MEDIA_CD=1

What is missing here is ID_CDROM_MEDIA_TRACK_COUNT_DATA to trigger
blkid in /lib/udev/rules.d/60-persistent-storage.rules

KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*",
	ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*",
	ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", \
		  IMPORT{builtin}="blkid --noraid"
2013-02-12 15:27:30 +01:00
Kay Sievers 1298001ec5 use the same email address everywhere 2012-11-12 19:47:43 +01:00
Kay Sievers e239cd8de0 udev: cdrom_id, accelerometer - enable debug output for --debug 2012-07-26 12:03:25 +02:00
Kay Sievers 47ef94ac5f udev: add some O_CLOEXEC 2012-07-05 17:33:24 +02:00
Kay Sievers baa30fbc2c udev: switch to systemd logging functions 2012-04-08 16:06:20 +02:00
Kay Sievers fc863deada udev: fix gcc warnings 2012-04-04 05:21:35 +02:00
Kay Sievers 3e2147858f move imported udev into place 2012-04-04 05:05:07 +02:00
Renamed from src/udev/src/cdrom_id/cdrom_id.c (Browse further)