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.
This commit is contained in:
Max Zinkus 2018-04-09 21:56:33 -07:00 committed by GitHub
parent b168c4a6d7
commit 65435dce78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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