util: add rename_noreplace
authorAlban Crequy <alban@endocode.com>
Tue, 10 Mar 2015 17:15:52 +0000 (18:15 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 10 Mar 2015 17:23:46 +0000 (18:23 +0100)
commitf85ef957e647c5182acf5e64298f68e4b7fbfe8f
tree505151f058adc41e72d262d044cc2b0092a148aa
parent27cc6f166bdebc0e698fb692993b801db2618866
util: add rename_noreplace

renameat2() exists since Linux 3.15 but btrfs support for the flag
RENAME_NOREPLACE was added later.

This patch implements a fallback when renameat2() returns EINVAL.
EINVAL is the error returned when the filesystem does not support one of
the flags.
src/import/import-raw.c
src/import/import-tar.c
src/import/pull-raw.c
src/import/pull-tar.c
src/shared/copy.c
src/shared/machine-image.c
src/shared/machine-pool.c
src/shared/util.c
src/shared/util.h