From 84f54567c1dff0bbba19afa0f9ac9903abe56ffb Mon Sep 17 00:00:00 2001 From: Vedran Ljubovic Date: Mon, 11 Sep 2006 12:47:48 +0000 Subject: [PATCH] Check if user pressed cancel in password dialog --- edelib2/Run.cpp | 3 +-- edelib2/Run.h | 1 + elauncher/elauncher.cpp | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/edelib2/Run.cpp b/edelib2/Run.cpp index 5acff31..6b7c1da 100755 --- a/edelib2/Run.cpp +++ b/edelib2/Run.cpp @@ -153,9 +153,8 @@ tryagain: // Run program as root using su or sudo char *line; - // TODO: fix password dialog so that Cancel can be detected - // At the moment it's impossible to tell if the password is blank const char *pwd = password(_("This program requires administrator privileges.\nPlease enter your password below:")); + if (pwd == 0) return EDERUN_USER_CANCELED; // Chat routine while (1) { diff --git a/edelib2/Run.h b/edelib2/Run.h index 6e2cf88..9de26f9 100755 --- a/edelib2/Run.h +++ b/edelib2/Run.h @@ -62,6 +62,7 @@ enum{ EDERUN_WAITPID_FAILED = 65531, EDERUN_EXECVE_FAILED = 65530, EDERUN_PTY_FAILED = 65529 + EDERUN_USER_CANCELED = 65528 }; diff --git a/elauncher/elauncher.cpp b/elauncher/elauncher.cpp index bde56ea..bdaceeb 100755 --- a/elauncher/elauncher.cpp +++ b/elauncher/elauncher.cpp @@ -453,9 +453,8 @@ tryagain: if (param_root) { char *line; - // TODO: fix password dialog so that Cancel can be detected - // At the moment it's impossible to tell if the password is blank const char *pwd = password(_("This program requires administrator privileges.\nPlease enter your password below:")); + if (pwd == 0) { fprintf(stderr,"Canceled\n"); exit(1); } // Chat routine while (1) {