]> granicus.if.org Git - python/commitdiff
give a nice message when installer is launched w/o admin rights (closes #16561)
authorBenjamin Peterson <benjamin@python.org>
Fri, 28 Nov 2014 02:39:02 +0000 (20:39 -0600)
committerBenjamin Peterson <benjamin@python.org>
Fri, 28 Nov 2014 02:39:02 +0000 (20:39 -0600)
PC/bdist_wininst/install.c

index 2b1deefa4c38dece36f837f2f17d997f2019ac87..8b5be619c39054a623040aaa71c51b97192b0fe7 100644 (file)
@@ -1742,6 +1742,16 @@ static BOOL OpenLogfile(char *dir)
 
     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),