Skip to content

Commit

Permalink
Fix symlink being created inside $OLD_MOUNT_PATH
Browse files Browse the repository at this point in the history
Fix return code and the symlink being created *inside* of the directory
$OLD_MOUNT_PATH, if this directory is not empty.

Note that solely empty directories inside of the $OLD_MOUNT_PATH
directory are removed by this shell script, e.g. files, symlinks and
non-empty directories are not!

While there should be no files, symlinks and non-empty directories
inside the $OLD_MOUNT_PATH directory, his is not fail-safe, plus the
script then creates the symlink *inside* of the directory
$OLD_MOUNT_PATH!

This simple fix at least returns an error in this case (which is not
evaluated anyway, AFAICS) and does not create another file-system object
inside the directory $OLD_MOUNT_PATH then.
  • Loading branch information
Olf0 authored and Tomin1 committed May 27, 2021
1 parent 98707fa commit e927ed3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions rpm/udisks2-symlink-mount-path
Expand Up @@ -21,6 +21,5 @@ do
rmdir ${path}
done

rmdir ${OLD_MOUNT_PATH}
ln -s /run/media/${DEVICEUSER} ${OLD_MOUNT_PATH}
rmdir ${OLD_MOUNT_PATH} && ln -s /run/media/${DEVICEUSER} ${OLD_MOUNT_PATH}
exit $?

0 comments on commit e927ed3

Please sign in to comment.