gnome-games r8305 - in trunk: aisleriot libgames-support
- From: thomashpa svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-games r8305 - in trunk: aisleriot libgames-support
- Date: Sun, 9 Nov 2008 21:04:03 +0000 (UTC)
Author: thomashpa
Date: Sun Nov 9 21:04:03 2008
New Revision: 8305
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8305&view=rev
Log:
Silence a few warnings
Modified:
trunk/aisleriot/game.c
trunk/libgames-support/eggdesktopfile.c
trunk/libgames-support/games-setgid-io.c
Modified: trunk/aisleriot/game.c
==============================================================================
--- trunk/aisleriot/game.c (original)
+++ trunk/aisleriot/game.c Sun Nov 9 21:04:03 2008
@@ -293,6 +293,16 @@
#define CALL_DATA_INIT { 0, 0, 0, 0, 0, 0 };
+void
+checked_write (int fildes, const void *buf, size_t nbyte)
+{
+ int n_written;
+ n_written = write (fildes, buf, nbyte);
+ if (n_written != nbyte){
+ g_warning ("A scheme exception occurred, and subsequently writing the error to a temporary file also failed");
+ }
+}
+
static void
cscmi_write_exception_details (int error_fd, SCM tag, SCM throw_args)
{
@@ -305,15 +315,15 @@
message = g_strdup_printf ("Variation: %s\n", aisleriot_game_get_game_file (game));
- write (error_fd, message, strlen (message));
+ checked_write (error_fd, message, strlen (message));
g_free (message);
message = g_strdup_printf ("Seed: %u\n", game->seed);
- write (error_fd, message, strlen (message));
+ checked_write (error_fd, message, strlen (message));
g_free (message);
message = "Scheme error:\n\t";
- write (error_fd, message, strlen (message));
+ checked_write (error_fd, message, strlen (message));
port = scm_fdopen (scm_from_int (error_fd),
scm_mem2string ("w", sizeof (char)));
@@ -321,23 +331,23 @@
scm_fsync (port);
message = "\nScheme tag:\n\t";
- write (error_fd, message, strlen (message));
+ checked_write (error_fd, message, strlen (message));
scm_display (tag, port);
scm_fsync (port);
message = "\n\nBacktrace:\n";
- write (error_fd, message, strlen (message));
+ checked_write (error_fd, message, strlen (message));
stack = scm_fluid_ref (SCM_VARIABLE_REF (scm_the_last_stack_fluid_var));
if (!SCM_FALSEP (stack)) {
scm_display_backtrace (stack, port, SCM_UNDEFINED, SCM_UNDEFINED);
scm_fsync (port);
} else {
message = "\tNo backtrace available.\n";
- write (error_fd, message, strlen (message));
+ checked_write (error_fd, message, strlen (message));
}
message = "\n\nDeck State:\n";
- write (error_fd, message, strlen (message));
+ checked_write (error_fd, message, strlen (message));
slots = aisleriot_game_get_slots (game);
@@ -349,7 +359,7 @@
guint n_cards;
message = g_strdup_printf ("\tSlot %d\n", slot->id);
- write (error_fd, message, strlen (message));
+ checked_write (error_fd, message, strlen (message));
g_free (message);
n_cards = cards->len;
@@ -364,34 +374,34 @@
message = "\t\t";
else
message = ", ";
- write (error_fd, message, strlen (message));
+ checked_write (error_fd, message, strlen (message));
message = g_strdup_printf ("(%d %d %s)",
CARD_GET_SUIT (card),
CARD_GET_RANK (card),
/* See c2scm_card below */
CARD_GET_FACE_DOWN (card) ? "#f" : "#t");
- write (error_fd, message, strlen (message));
+ checked_write (error_fd, message, strlen (message));
g_free (message);
count++;
if (count == 5) {
message = "\n";
- write (error_fd, message, strlen (message));
+ checked_write (error_fd, message, strlen (message));
count = 0;
}
}
if (count != 0) {
message = "\n";
- write (error_fd, message, strlen (message));
+ checked_write (error_fd, message, strlen (message));
}
} else {
message = "\t\t(Empty)\n";
- write (error_fd, message, strlen (message));
+ checked_write (error_fd, message, strlen (message));
}
}
} else {
message = "\tNo cards in deck\n";
- write (error_fd, message, strlen (message));
+ checked_write (error_fd, message, strlen (message));
}
}
Modified: trunk/libgames-support/eggdesktopfile.c
==============================================================================
--- trunk/libgames-support/eggdesktopfile.c (original)
+++ trunk/libgames-support/eggdesktopfile.c Sun Nov 9 21:04:03 2008
@@ -1072,7 +1072,7 @@
GError **error)
{
EggDesktopFileLaunchOption option;
- GSList *translated_documents, *docs;
+ GSList *translated_documents = NULL, *docs;
char *command, **argv;
int argc, i, screen_num;
gboolean success, current_success;
@@ -1277,8 +1277,10 @@
g_strfreev ((char **)env->pdata);
g_ptr_array_free (env, FALSE);
}
- free_document_list (translated_documents);
-
+ if (translated_documents != NULL)
+ {
+ free_document_list (translated_documents);
+ }
return success;
}
Modified: trunk/libgames-support/games-setgid-io.c
==============================================================================
--- trunk/libgames-support/games-setgid-io.c (original)
+++ trunk/libgames-support/games-setgid-io.c Sun Nov 9 21:04:03 2008
@@ -95,7 +95,11 @@
static void
write_cmd (unsigned char cmd)
{
- write (setgid_io_outfd, &cmd, 1);
+ int cnt;
+ cnt = write (setgid_io_outfd, &cmd, 1);
+ if (cnt != 1) {
+ g_warning ("An error occured while writing to file");
+ }
}
@@ -136,7 +140,11 @@
static void
write_int (int fd, int i)
{
- write (fd, &i, sizeof (int));
+ int cnt;
+ cnt = write (fd, &i, sizeof (int));
+ if (cnt != sizeof (int)) {
+ g_warning ("An error occured while writing to file");
+ }
}
static int
@@ -153,7 +161,11 @@
static void
write_off_t (int fd, off_t o)
{
- write (fd, &o, sizeof (off_t));
+ int cnt;
+ cnt = write (fd, &o, sizeof (off_t));
+ if (cnt != sizeof (off_t)) {
+ g_warning ("An error occured while writing to file");
+ }
}
static off_t
@@ -514,9 +526,12 @@
int setgid_io_outpipe[2];
g_return_if_fail (setgid_io_initialised == 0);
- pipe (setgid_io_inpipe);
- pipe (setgid_io_outpipe);
- /* FIXME: Error checking. */
+ if (pipe (setgid_io_inpipe) != 0){
+ g_warning("Unable to create pipe");
+ }
+ if (pipe (setgid_io_outpipe) != 0){
+ g_warning("Unable to create pipe");
+ }
if ((setgid_io_child_pid = fork ()) != 0) {
close (setgid_io_inpipe[1]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]