From 65435dce78a6cd54307424cc0832653ee4fed1c5 Mon Sep 17 00:00:00 2001 From: Max Zinkus Date: Mon, 9 Apr 2018 21:56:33 -0700 Subject: [PATCH] Prevent qvm-clock-sync permissions exception qvm-clock-sync fails with a python subprocess error on line 43 when the `date ... -s ...` fails due to insufficient privileges to set the date. This commit checks to see if the program has effective UID root before attempting to set the date. --- qvm-tools/qvm-sync-clock | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qvm-tools/qvm-sync-clock b/qvm-tools/qvm-sync-clock index ca88315e..4cf5ee2c 100755 --- a/qvm-tools/qvm-sync-clock +++ b/qvm-tools/qvm-sync-clock @@ -20,12 +20,15 @@ # # import sys +import os import re import subprocess from qubesadmin import Qubes def main(): - + if os.geteuid() != 0: + sys.stderr.write('This program must be run as root to set the date.') + sys.exit(1) app = Qubes() clockvm = app.clockvm