25
25
26
26
#include <stdio.h>
27
27
#include <string.h>
28
- #include <stdarg.h>
29
28
#include <stdlib.h>
30
29
#include <glib.h>
31
30
#include <gnome-keyring.h>
@@ -58,30 +57,6 @@ struct credential_operation
58
57
#define CREDENTIAL_OP_END \
59
58
{ NULL,NULL }
60
59
61
- /* ---------------- common helper functions ----------------- */
62
-
63
- static inline void warning (const char * fmt , ...)
64
- {
65
- va_list ap ;
66
-
67
- va_start (ap , fmt );
68
- fprintf (stderr , "warning: " );
69
- vfprintf (stderr , fmt , ap );
70
- fprintf (stderr , "\n" );
71
- va_end (ap );
72
- }
73
-
74
- static inline void error (const char * fmt , ...)
75
- {
76
- va_list ap ;
77
-
78
- va_start (ap , fmt );
79
- fprintf (stderr , "error: " );
80
- vfprintf (stderr , fmt , ap );
81
- fprintf (stderr , "\n" );
82
- va_end (ap );
83
- }
84
-
85
60
/* ----------------- GNOME Keyring functions ----------------- */
86
61
87
62
/* create a special keyring option string, if path is given */
@@ -127,7 +102,7 @@ static int keyring_get(struct credential *c)
127
102
return EXIT_SUCCESS ;
128
103
129
104
if (result != GNOME_KEYRING_RESULT_OK ) {
130
- error ("%s" ,gnome_keyring_result_to_message (result ));
105
+ g_critical ("%s" , gnome_keyring_result_to_message (result ));
131
106
return EXIT_FAILURE ;
132
107
}
133
108
@@ -220,7 +195,7 @@ static int keyring_erase(struct credential *c)
220
195
221
196
if (result != GNOME_KEYRING_RESULT_OK )
222
197
{
223
- error ("%s" ,gnome_keyring_result_to_message (result ));
198
+ g_critical ("%s" , gnome_keyring_result_to_message (result ));
224
199
return EXIT_FAILURE ;
225
200
}
226
201
@@ -234,7 +209,7 @@ static int keyring_erase(struct credential *c)
234
209
235
210
if (result != GNOME_KEYRING_RESULT_OK )
236
211
{
237
- error ("%s" ,gnome_keyring_result_to_message (result ));
212
+ g_critical ("%s" , gnome_keyring_result_to_message (result ));
238
213
return EXIT_FAILURE ;
239
214
}
240
215
@@ -292,7 +267,7 @@ static int credential_read(struct credential *c)
292
267
293
268
value = strchr (buf ,'=' );
294
269
if (!value ) {
295
- warning ("invalid credential line: %s" , key );
270
+ g_warning ("invalid credential line: %s" , key );
296
271
gnome_keyring_memory_free (buf );
297
272
return -1 ;
298
273
}
0 commit comments