diff --git a/qubes-rpc/qfile-agent.c b/qubes-rpc/qfile-agent.c index c4d789e5..86543fd3 100644 --- a/qubes-rpc/qfile-agent.c +++ b/qubes-rpc/qfile-agent.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -82,10 +83,17 @@ int main(int argc, char **argv) invocation_cwd_fd = open(".", O_PATH | O_DIRECTORY); if (invocation_cwd_fd < 0) gui_fatal("open \".\""); + bool ignore_options = false; for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "--ignore-symlinks")==0) { - ignore_symlinks = 1; - continue; + if (!ignore_options) { + if (strcmp(argv[i], "--ignore-symlinks")==0) { + ignore_symlinks = 1; + continue; + } + if (strcmp(argv[i], "--") == 0) { + ignore_options = true; + continue; + } } if (!*argv[i]) gui_fatal("Invalid empty argument %i", i); diff --git a/qubes-rpc/qvm-copy b/qubes-rpc/qvm-copy index 3726a341..27d1bc2b 100755 --- a/qubes-rpc/qvm-copy +++ b/qubes-rpc/qvm-copy @@ -21,7 +21,7 @@ set -e -o pipefail -unset PROGRESS_TYPE OPERATION_TYPE TARGET_TYPE MIN_ARGS FILECOPY_TOTAL_BYTES service +unset PROGRESS_TYPE OPERATION_TYPE TARGET_TYPE MIN_ARGS FILECOPY_TOTAL_BYTES service ignore_symlinks case ${0##*/} in (qvm-move) OPERATION_TYPE=move TARGET_TYPE=default MIN_ARGS=1;; @@ -33,9 +33,9 @@ esac usage () { if [ "$TARGET_TYPE" = "vm" ]; then - echo "usage: $0 [--without-progress] destination_qube_name FILE [FILE ...]" + echo "usage: $0 [--without-progress] [--ignore-symlinks] destination_qube_name FILE [FILE ...]" else - echo "usage: $0 [--without-progress] FILE [FILE ...]" + echo "usage: $0 [--without-progress] [--ignore-symlinks] FILE [FILE ...]" fi echo @@ -58,6 +58,7 @@ export PROGRESS_TYPE=console while [ "$#" -gt 0 ]; do case $1 in (--without-progress) export PROGRESS_TYPE=none; shift;; + (--ignore-symlinks) ignore_symlinks=true; shift;; (-h|--help) usage 0;; (--) shift; break;; (-*) usage 1;; @@ -85,7 +86,7 @@ fi if [[ "$PROGRESS_TYPE" = 'console' ]]; then export FILECOPY_TOTAL_BYTES; fi /usr/lib/qubes/qrexec-client-vm --filter-escape-chars-stderr -- "$VM" \ - "$service" /usr/lib/qubes/qfile-agent "$@" + "$service" /usr/lib/qubes/qfile-agent ${ignore_symlinks+--ignore-symlinks} -- "$@" if [ "$OPERATION_TYPE" = "move" ] ; then rm -rf -- "$@"