summaryrefslogtreecommitdiff
path: root/contrib/gnome-ssh-askpass1.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-askpass1.c
parent1d871767498c4bc31221b74ecf9e253c6df6e1ae (diff)
- (djm) Made GNOME askpass programs return non-zero if cancel button is
pressed.
Diffstat (limited to 'contrib/gnome-ssh-askpass1.c')
-rw-r--r--contrib/gnome-ssh-askpass1.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/contrib/gnome-ssh-askpass1.c b/contrib/gnome-ssh-askpass1.c
index 7cece5620..b6b342b84 100644
--- a/contrib/gnome-ssh-askpass1.c
+++ b/contrib/gnome-ssh-askpass1.c
@@ -38,7 +38,7 @@
38 * Compile with: 38 * Compile with:
39 * 39 *
40 * cc `gnome-config --cflags gnome gnomeui` \ 40 * cc `gnome-config --cflags gnome gnomeui` \
41 * gnome-ssh-askpass.c -o gnome-ssh-askpass \ 41 * gnome-ssh-askpass1.c -o gnome-ssh-askpass \
42 * `gnome-config --libs gnome gnomeui` 42 * `gnome-config --libs gnome gnomeui`
43 * 43 *
44 */ 44 */
@@ -64,7 +64,7 @@ report_failed_grab (void)
64 gnome_dialog_run_and_close(GNOME_DIALOG(err)); 64 gnome_dialog_run_and_close(GNOME_DIALOG(err));
65} 65}
66 66
67void 67int
68passphrase_dialog(char *message) 68passphrase_dialog(char *message)
69{ 69{
70 char *passphrase; 70 char *passphrase;
@@ -135,7 +135,7 @@ passphrase_dialog(char *message)
135 gtk_entry_set_text(GTK_ENTRY(entry), passphrase); 135 gtk_entry_set_text(GTK_ENTRY(entry), passphrase);
136 136
137 gnome_dialog_close(GNOME_DIALOG(dialog)); 137 gnome_dialog_close(GNOME_DIALOG(dialog));
138 return; 138 return (result == 0 ? 0 : -1);
139 139
140 /* At least one grab failed - ungrab what we got, and report 140 /* At least one grab failed - ungrab what we got, and report
141 the failure to the user. Note that XGrabServer() cannot 141 the failure to the user. Note that XGrabServer() cannot
@@ -148,13 +148,15 @@ passphrase_dialog(char *message)
148 gnome_dialog_close(GNOME_DIALOG(dialog)); 148 gnome_dialog_close(GNOME_DIALOG(dialog));
149 149
150 report_failed_grab(); 150 report_failed_grab();
151 return (-1);
151} 152}
152 153
153int 154int
154main(int argc, char **argv) 155main(int argc, char **argv)
155{ 156{
156 char *message; 157 char *message;
157 158 int result;
159
158 gnome_init("GNOME ssh-askpass", "0.1", argc, argv); 160 gnome_init("GNOME ssh-askpass", "0.1", argc, argv);
159 161
160 if (argc == 2) 162 if (argc == 2)
@@ -163,6 +165,7 @@ main(int argc, char **argv)
163 message = "Enter your OpenSSH passphrase:"; 165 message = "Enter your OpenSSH passphrase:";
164 166
165 setvbuf(stdout, 0, _IONBF, 0); 167 setvbuf(stdout, 0, _IONBF, 0);
166 passphrase_dialog(message); 168 result = passphrase_dialog(message);
167 return 0; 169
170 return (result);
168} 171}