summaryrefslogtreecommitdiff
path: root/contrib/gnome-ssh-askpass2.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-09-12 14:49:00 +1000
committerDamien Miller <djm@mindrot.org>2002-09-12 14:49:00 +1000
commit10f3085137e80c1b01b07a807cc40688738d5db5 (patch)
tree601a84b8d7097122f0611ed4743ef304866b6a81 /contrib/gnome-ssh-askpass2.c
parent1d871767498c4bc31221b74ecf9e253c6df6e1ae (diff)
- (djm) Made GNOME askpass programs return non-zero if cancel button is
pressed.
Diffstat (limited to 'contrib/gnome-ssh-askpass2.c')
-rw-r--r--contrib/gnome-ssh-askpass2.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/contrib/gnome-ssh-askpass2.c b/contrib/gnome-ssh-askpass2.c
index 8cccf9e60..89a412aa8 100644
--- a/contrib/gnome-ssh-askpass2.c
+++ b/contrib/gnome-ssh-askpass2.c
@@ -40,7 +40,7 @@
40 * Compile with: 40 * Compile with:
41 * 41 *
42 * cc `pkg-config --cflags gtk+-2.0` \ 42 * cc `pkg-config --cflags gtk+-2.0` \
43 * gnome-ssh-askpass.c -o gnome-ssh-askpass \ 43 * gnome-ssh-askpass2.c -o gnome-ssh-askpass \
44 * `pkg-config --libs gtk+-2.0` 44 * `pkg-config --libs gtk+-2.0`
45 * 45 *
46 */ 46 */
@@ -79,7 +79,7 @@ ok_dialog(GtkWidget *entry, gpointer dialog)
79 gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); 79 gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
80} 80}
81 81
82static void 82static int
83passphrase_dialog(char *message) 83passphrase_dialog(char *message)
84{ 84{
85 const char *failed; 85 const char *failed;
@@ -165,7 +165,7 @@ passphrase_dialog(char *message)
165 g_free(passphrase); 165 g_free(passphrase);
166 166
167 gtk_widget_destroy(dialog); 167 gtk_widget_destroy(dialog);
168 return; 168 return (result == GTK_RESPONSE_OK ? 0 : -1);
169 169
170 /* At least one grab failed - ungrab what we got, and report 170 /* At least one grab failed - ungrab what we got, and report
171 the failure to the user. Note that XGrabServer() cannot 171 the failure to the user. Note that XGrabServer() cannot
@@ -178,13 +178,16 @@ passphrase_dialog(char *message)
178 gtk_widget_destroy(dialog); 178 gtk_widget_destroy(dialog);
179 179
180 report_failed_grab(failed); 180 report_failed_grab(failed);
181
182 return (-1);
181} 183}
182 184
183int 185int
184main(int argc, char **argv) 186main(int argc, char **argv)
185{ 187{
186 char *message; 188 char *message;
187 189 int result;
190
188 gtk_init(&argc, &argv); 191 gtk_init(&argc, &argv);
189 192
190 if (argc > 1) { 193 if (argc > 1) {
@@ -194,8 +197,8 @@ main(int argc, char **argv)
194 } 197 }
195 198
196 setvbuf(stdout, 0, _IONBF, 0); 199 setvbuf(stdout, 0, _IONBF, 0);
197 passphrase_dialog(message); 200 result = passphrase_dialog(message);
198 g_free(message); 201 g_free(message);
199 202
200 return 0; 203 return (result);
201} 204}