diff options
| author | Rafał Miłecki | 2018-11-30 13:09:22 +0000 |
|---|---|---|
| committer | Rafał Miłecki | 2018-12-04 08:15:34 +0000 |
| commit | 5dc631d19f6031cdbc426c9719affa4af858b35a (patch) | |
| tree | dc8bbf185faed4bf668708aad1e02b1c2183dffa | |
| parent | 29717790c905ad3c67a6b66d04a50393b5435c56 (diff) | |
| download | fstools-5dc631d19f6031cdbc426c9719affa4af858b35a.tar.gz | |
block: simplify code picking mount target directory
Using a set of 3 conditional block each setting "target" variable makes
code easier to follow.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Michael Heimpold <mhei@heimpold.de>
| -rw-r--r-- | block.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1025,8 +1025,8 @@ static int mount_device(struct probe_info *pr, int type) blockd_notify(device, m, pr); if (m) { - char *target = m->target; char _target[32]; + char *target; int err = 0; switch (type) { @@ -1049,8 +1049,9 @@ static int mount_device(struct probe_info *pr, int type) if (m->autofs) { snprintf(_target, sizeof(_target), "/tmp/run/blockd/%s", device); target = _target; - } - if (!target) { + } else if (m->target) { + target = m->target; + } else { snprintf(_target, sizeof(_target), "/mnt/%s", device); target = _target; } |