summaryrefslogtreecommitdiffstats
path: root/libblkid/src/save.c
Commit message (Collapse)AuthorAgeFilesLines
* libblkid: check number of test_blkid_save arguments correctlySami Kerola2019-07-141-1/+1
| | | | | | | Without this running test_blkid_save without arguments will cause a crash when strdup() refers to none-exiting file name. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libblkid: don't check nonnull attributes for NULL [-Wnonnull-compare]Karel Zak2016-06-141-3/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: provide fallback if mkostemp(3) missingRuediger Meier2016-02-291-1/+2
| | | | | | | It's missing on OSX. CC: Yuriy M. Kaminskiy <yumkam@gmail.com> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libblkid: care about unsafe chars in cacheKarel Zak2014-11-271-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The high-level libblkid API uses /run/blkid/blkid.tab cache to store probing results. The cache format is <device NAME="value" ...>devname</device> and unfortunately the cache code does not escape quotation marks: # mkfs.ext4 -L 'AAA"BBB' # cat /run/blkid/blkid.tab ... <device ... LABEL="AAA"BBB" ...>/dev/sdb1</device> such string is later incorrectly parsed and blkid(8) returns nonsenses. And for use-cases like # eval $(blkid -o export /dev/sdb1) it's also insecure. Note that mount, udevd and blkid -p are based on low-level libblkid API, it bypass the cache and directly read data from the devices. The current udevd upstream does not depend on blkid(8) output at all, it's directly linked with the library and all unsafe chars are encoded by \x<hex> notation. # mkfs.ext4 -L 'X"`/tmp/foo` "' /dev/sdb1 # udevadm info --export-db | grep LABEL ... E: ID_FS_LABEL=X__/tmp/foo___ E: ID_FS_LABEL_ENC=X\x22\x60\x2ftmp\x2ffoo\x60\x20\x22 Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: use new debug functionsKarel Zak2014-03-211-11/+11
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: check writing to a file was successfulSami Kerola2013-04-261-1/+6
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libblkid: clean up DBG()Karel Zak2013-04-081-19/+11Star
| | | | | | | | | - use stderr only - use BLKID_ prefix for debug masks - don't use \n in in messages and don't use printf(), but use generic blkid_debug(). Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: use O_CLOEXECKarel Zak2013-04-031-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: check mkdir(/run/blkid) return code [coverity scan]Karel Zak2012-12-121-5/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: remove blkid_{strndup,strdup}Karel Zak2012-11-301-1/+1
| | | | | | | Don't try to be smart. Let's use standard libc functions. (Note that we have fallback for strndup() in include/strutils.h) Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: check fchmod() return value [coverity scan]Karel Zak2012-09-071-3/+6
|
* libblkid: check for NULL in blkid_flush_cache() [coverity scan]Karel Zak2012-01-311-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: check rename() return value [coverity scan]Karel Zak2012-01-311-3/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: move cache to /run on new systemsKarel Zak2012-01-251-3/+18
| | | | | | | | | | | | | | | | | | | | | | Why? * read-only root * /etc is pretty bad place for caches * all is usually cached by udev in /dev/disk/by-* and libblkid is able to use these symlinks * boot persistent cache is attractive for very small subset of Linux machines (and they already need extra udev tunning otherwise udev will probe all block devices during boot) * the default is possible to override in /etc/blkid.conf The systems without /run directory will not be affected by this change. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: use top-level directory for libblkid rather than shlibs/blkidKarel Zak2011-06-091-0/+196
Signed-off-by: Karel Zak <kzak@redhat.com>