[Pkg-privacy-commits] [tails-installer] 102/210: Previously when user wanted to print out --help message user was forced to do it under root account which is a quite inpractical.

Intrigeri intrigeri at moszumanska.debian.org
Wed May 24 15:26:33 UTC 2017


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to tag 3.90.0
in repository tails-installer.

commit dd5562598ead37c8f840e78c642c34fc98085ee9
Author: Andrej Manduch <amanduch at redhat.com>
Date:   Tue Jun 9 18:07:46 2015 -0400

    Previously when user wanted to print out --help message user was forced
    to do it under root account which is a quite inpractical.
    
    By moveing `getuid() != 0` check after parse_args it will be
    asured that this is no longer the case
    
    Before this patch:
    burlak at borg /m/c/liveusb-creator (develop) $ liveusb-creator --help
    You must run this application as root
    
    After this patch:
    burlak at borg /m/c/liveusb-creator (develop) $ ./liveusb-creator --help
    Usage: liveusb-creator [options]
    
    Options:
      --version             show program's version number and exit
      -h, --help            show this help message and exit
      -c, --console         Use console mode instead of the GUI
    
    Signed-off-by: Andrej Manduch <amanduch at redhat.com>
    Signed-off-by: Luke Macken <lmacken at redhat.com>
---
 liveusb-creator | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/liveusb-creator b/liveusb-creator
index 2fcc667..e4d5965 100755
--- a/liveusb-creator
+++ b/liveusb-creator
@@ -72,6 +72,11 @@ def parse_args():
 
 def main():
     opts, args = parse_args()
+    if sys.platform != 'win32':
+        if os.getuid() != 0:
+            print >> sys.stderr, _("You must run this application as root")
+            sys.exit(1)
+
     if opts.console:
         from liveusb import LiveUSBCreator
         try:
@@ -93,8 +98,4 @@ def main():
             pass
 
 if __name__ == '__main__':
-    if sys.platform != 'win32':
-        if os.getuid() != 0:
-            print >> sys.stderr, _("You must run this application as root")
-            sys.exit(1)
     main()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/tails-installer.git



More information about the Pkg-privacy-commits mailing list