[Python-checkins] cpython (2.7): give a nice message when installer is launched w/o admin rights (closes #16561)

benjamin.peterson python-checkins at python.org
Fri Nov 28 03:41:54 CET 2014


https://hg.python.org/cpython/rev/1ac5aec658f6
changeset:   93636:1ac5aec658f6
branch:      2.7
parent:      93595:080dba0e66e4
user:        Benjamin Peterson <benjamin at python.org>
date:        Thu Nov 27 20:39:02 2014 -0600
summary:
  give a nice message when installer is launched w/o admin rights (closes #16561)

files:
  PC/bdist_wininst/install.c |  10 ++++++++++
  1 files changed, 10 insertions(+), 0 deletions(-)


diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c
--- a/PC/bdist_wininst/install.c
+++ b/PC/bdist_wininst/install.c
@@ -1742,6 +1742,16 @@
 
     sprintf(buffer, "%s\\%s-wininst.log", dir, meta_name);
     logfile = fopen(buffer, "a");
+    if (!logfile) {
+        char error[1024];
+
+        sprintf(error, "Can't create \"%s\" (%s).\n\n"
+                "Try to execute the installer as administrator.",
+                buffer, strerror(errno));
+        MessageBox(GetFocus(), error, NULL, MB_OK | MB_ICONSTOP);
+        return FALSE;
+    }
+
     time(&ltime);
     now = localtime(&ltime);
     strftime(buffer, sizeof(buffer),

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list