kov changed libgksu/trunk/ChangeLog, libgksu/trunk/libgksu/libgksu.c
Gustavo Noronha
kov at costa.debian.org
Sun Jun 25 23:43:19 UTC 2006
Mensagem de log:
- use TRUE for success and FALSE for failure, to match glib's
spawn API - well, it's a development release =D
-----
Modified: libgksu/trunk/ChangeLog
===================================================================
--- libgksu/trunk/ChangeLog 2006-06-25 23:15:47 UTC (rev 629)
+++ libgksu/trunk/ChangeLog 2006-06-25 23:43:15 UTC (rev 630)
@@ -1,6 +1,10 @@
2006-06-25 Gustavo Noronha Silva <kov at debian.org>
* libgksu/libgksu.c:
+ - use TRUE for success and FALSE for failure - well, it's
+ a development release =D
+
+ * libgksu/libgksu.c:
- handle canceling the dialog correctly; added a new
error to the enum
Modified: libgksu/trunk/libgksu/libgksu.c
===================================================================
--- libgksu/trunk/libgksu/libgksu.c 2006-06-25 23:15:47 UTC (rev 629)
+++ libgksu/trunk/libgksu/libgksu.c 2006-06-25 23:43:15 UTC (rev 630)
@@ -1048,7 +1048,7 @@
* environment variable and xauth-related stuff. Also
* creates a temporary directory to hold a .Xauthority
*
- * Returns: 0 if it suceeds.
+ * Returns: TRUE if it suceeds, FALSE if it fails.
*/
static int
prepare_xauth (GksuContext *context)
@@ -1082,7 +1082,7 @@
"Failed to obtain xauth key: xauth binary not found "
"at usual locations");
- return 1;
+ return FALSE;
}
/* get the authorization token */
@@ -1095,7 +1095,7 @@
fprintf (stderr,
"Failed to obtain xauth key: %s",
strerror(errno));
- return 1;
+ return FALSE;
}
fread (xauth, sizeof(char), 255, xauth_output);
pclose (xauth_output);
@@ -1111,7 +1111,7 @@
context->xauth, context->display);
}
- return 0;
+ return TRUE;
}
/* Write all of buf, even if write(2) is interrupted. */
@@ -1160,7 +1160,7 @@
"Error copying '%s' to '%s': %s",
fn, dir, strerror(errno));
- return TRUE;
+ return FALSE;
}
in = open(fn, O_RDONLY);
@@ -1169,7 +1169,7 @@
fprintf (stderr,
"Error copying '%s' to '%s': %s",
fn, dir, strerror(errno));
- return TRUE;
+ return FALSE;
}
while ((r = read(in, buf, BUFSIZ)) > 0)
@@ -1179,7 +1179,7 @@
fprintf (stderr,
"Error copying '%s' to '%s': %s",
fn, dir, strerror(errno));
- return TRUE;
+ return FALSE;
}
}
@@ -1188,10 +1188,10 @@
fprintf (stderr,
"Error copying '%s' to '%s': %s",
fn, dir, strerror(errno));
- return TRUE;
+ return FALSE;
}
- return FALSE;
+ return TRUE;
}
static gboolean
@@ -1205,20 +1205,20 @@
if (!context->dir)
{
fprintf (stderr, strerror(errno));
- return 1;
+ return FALSE;
}
xauth = g_strdup(g_getenv ("XAUTHORITY"));
if (xauth == NULL)
xauth = g_strdup_printf ("%s/.Xauthority", g_get_home_dir());
- error_copying = copy (xauth, context->dir);
+ error_copying = !copy (xauth, context->dir);
g_free (xauth);
if (error_copying)
- return 1;
+ return FALSE;
- return 0;
+ return TRUE;
}
static void
@@ -1581,7 +1581,7 @@
*
* This function uses su as backend.
*
- * Returns: FALSE if all went fine, TRUE if failed
+ * Returns: TRUE if all went fine, FALSE if failed
*/
gboolean
gksu_su_full (GksuContext *context,
@@ -1608,7 +1608,7 @@
g_set_error (error, gksu_quark, GKSU_ERROR_NOCOMMAND,
_("gksu_run needs a command to be run, "
"none was provided."));
- return TRUE;
+ return FALSE;
}
if (!context->user)
@@ -1619,13 +1619,15 @@
g_set_error (error, gksu_quark, GKSU_ERROR_HELPER,
_("The gksu-run-helper command was not found or "
"is not executable."));
- return TRUE;
+ return FALSE;
}
- /*
- FIXME: need to provide GError stuff
- */
- prepare_xauth (context);
+ if (!prepare_xauth (context))
+ {
+ g_set_error (error, gksu_quark, GKSU_ERROR_XAUTH,
+ _("Unable to copy the user's Xauthorization file."));
+ return FALSE;
+ }
if(context->sn_context)
{
@@ -1676,7 +1678,7 @@
g_set_error (error, gksu_quark, GKSU_ERROR_FORK,
_("Failed to fork new process: %s"),
strerror(errno));
- return TRUE;
+ return FALSE;
}
else
{
@@ -1860,7 +1862,7 @@
if (context->debug)
fprintf (stderr, "DEBUG (failed!) buf: -%s-\n", buf);
- return TRUE;
+ return FALSE;
}
if (!password_needed || used_gnome_keyring)
@@ -1905,7 +1907,7 @@
_("Could not read from the pipe "
"with the child: %s"),
strerror(errno));
- return TRUE;
+ return FALSE;
}
if(FD_ISSET(fdpty, &rfds))
@@ -1938,7 +1940,7 @@
if (!g_str_has_suffix (cmdline, "su\n"))
{
g_free (cmdline);
- return TRUE;
+ return FALSE;
}
g_free (cmdline);
}
@@ -1953,9 +1955,9 @@
}
if (error)
- return TRUE;
+ return FALSE;
- return FALSE;
+ return TRUE;
}
/**
@@ -1969,7 +1971,7 @@
* ones being called. A simple #GksuContext is created to hold the
* user name and the command.
*
- * Returns: FALSE if all went well, TRUE if an error happend.
+ * Returns: TRUE if all went well, FALSE if an error happend.
*/
gboolean
gksu_su (gchar *command_line, GError **error)
@@ -2012,7 +2014,7 @@
*
* This function uses the sudo backend.
*
- * Returns: FALSE if all went fine, TRUE if failed
+ * Returns: TRUE if all went fine, FALSE if failed
*/
gboolean
gksu_sudo_full (GksuContext *context,
@@ -2048,7 +2050,7 @@
g_set_error (error, gksu_quark, GKSU_ERROR_NOCOMMAND,
_("gksu_sudo_run needs a command to be run, "
"none was provided."));
- return TRUE;
+ return FALSE;
}
if (!context->user)
@@ -2069,11 +2071,11 @@
/*
FIXME: need to set GError in a more detailed way
*/
- if (sudo_prepare_xauth (context) == 1)
+ if (!sudo_prepare_xauth (context))
{
g_set_error (error, gksu_quark, GKSU_ERROR_XAUTH,
_("Unable to copy the user's Xauthorization file."));
- return TRUE;
+ return FALSE;
}
/* sets XAUTHORITY */
@@ -2196,7 +2198,7 @@
_("Error creating pipe: %s"),
strerror(errno));
sudo_reset_xauth (context, xauth, xauth_env);
- return TRUE;
+ return FALSE;
}
if ((pipe(child_pipe)) == -1)
@@ -2205,7 +2207,7 @@
_("Error creating pipe: %s"),
strerror(errno));
sudo_reset_xauth (context, xauth, xauth_env);
- return TRUE;
+ return FALSE;
}
pid = fork();
@@ -2215,7 +2217,7 @@
_("Failed to fork new process: %s"),
strerror(errno));
sudo_reset_xauth (context, xauth, xauth_env);
- return TRUE;
+ return FALSE;
}
else if (pid == 0)
{
@@ -2231,7 +2233,7 @@
_("Failed to exec new process: %s"),
strerror(errno));
sudo_reset_xauth (context, xauth, xauth_env);
- return TRUE;
+ return FALSE;
}
else
{
@@ -2247,7 +2249,7 @@
_("Error opening pipe: %s"),
strerror(errno));
sudo_reset_xauth (context, xauth, xauth_env);
- return TRUE;
+ return FALSE;
}
outfile = fdopen(child_pipe[1], "w");
@@ -2257,7 +2259,7 @@
_("Error opening pipe: %s"),
strerror(errno));
sudo_reset_xauth (context, xauth, xauth_env);
- return TRUE;
+ return FALSE;
}
/*
@@ -2289,7 +2291,7 @@
if (password == NULL || error)
{
nullify_password (password);
- return TRUE;
+ return FALSE;
}
usleep (100);
@@ -2396,7 +2398,7 @@
if (!g_str_has_suffix (cmdline, "sudo\n"))
{
g_free (cmdline);
- return TRUE;
+ return FALSE;
}
g_free (cmdline);
}
@@ -2412,9 +2414,9 @@
/* if error is set we have found an error condition */
if (error)
- return TRUE;
+ return FALSE;
- return FALSE;
+ return TRUE;
}
/**
@@ -2428,7 +2430,7 @@
* ones being called. A simple #GksuContext is created to hold the
* user name and the command.
*
- * Returns: FALSE if all went well, TRUE if an error happend.
+ * Returns: TRUE if all went well, FALSE if an error happend.
*/
gboolean
gksu_sudo (gchar *command_line,
@@ -2469,7 +2471,7 @@
* the default behavior for gksu is su or sudo mode. This is the
* recommended way of using the library functionality.
*
- * Returns: FALSE if all went fine, TRUE if failed
+ * Returns: TRUE if all went fine, FALSE if failed
*/
gboolean
gksu_run_full (GksuContext *context,
More information about the gksu-commits
mailing list