diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-11-27 20:39:02 -0600 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-11-27 20:39:02 -0600 |
commit | 598238668cf7c45ea2deaaf3fb963bf3618cb08c (patch) | |
tree | ff3382c5fc31d795632d321dd72468ab5371d4ad | |
parent | d12e8def2080339bbdfa0b9ee8c4b0ce6c056c5a (diff) | |
download | cpython-598238668cf7c45ea2deaaf3fb963bf3618cb08c.tar.gz |
give a nice message when installer is launched w/o admin rights (closes #16561)
-rw-r--r-- | 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 index 2b1deefa4c..8b5be619c3 100644 --- a/PC/bdist_wininst/install.c +++ b/PC/bdist_wininst/install.c @@ -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(<ime); now = localtime(<ime); strftime(buffer, sizeof(buffer), |