Skip to content

Commit 490e3b1

Browse files
committed
give a nice message when installer is launched w/o admin rights (closes #16561)
1 parent eca6164 commit 490e3b1

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

PC/bdist_wininst/install.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,6 +1742,16 @@ static BOOL OpenLogfile(char *dir)
17421742

17431743
sprintf(buffer, "%s\\%s-wininst.log", dir, meta_name);
17441744
logfile = fopen(buffer, "a");
1745+
if (!logfile) {
1746+
char error[1024];
1747+
1748+
sprintf(error, "Can't create \"%s\" (%s).\n\n"
1749+
"Try to execute the installer as administrator.",
1750+
buffer, strerror(errno));
1751+
MessageBox(GetFocus(), error, NULL, MB_OK | MB_ICONSTOP);
1752+
return FALSE;
1753+
}
1754+
17451755
time(&ltime);
17461756
now = localtime(&ltime);
17471757
strftime(buffer, sizeof(buffer),

0 commit comments

Comments
 (0)