[gnome-games] libgames-support: Only build games-setgid-io when --enable-setgid
- From: Christian Persch <chpe src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games] libgames-support: Only build games-setgid-io when --enable-setgid
- Date: Sat, 11 Jul 2009 14:37:31 +0000 (UTC)
commit 0a94988d9f25e489c74f5cc11507016ffbc49d9d
Author: Christian Persch <chpe gnome org>
Date: Sat Jul 11 16:28:28 2009 +0200
libgames-support: Only build games-setgid-io when --enable-setgid
Add some #ifdefs to games-scores-backend to only use setgid IO when it's
enabled in configure, and only then build games-setgid-io.[ch].
Should fix bug #445270, but of course scores are not working at all with
--disable-setgid, as before.
libgames-support/Makefile.am | 10 ++++++++--
libgames-support/games-scores-backend.c | 19 ++++++++++++++++++-
libgames-support/games-scores-backend.h | 5 ++++-
3 files changed, 30 insertions(+), 4 deletions(-)
---
diff --git a/libgames-support/Makefile.am b/libgames-support/Makefile.am
index 6d0cef4..6bc2a5e 100644
--- a/libgames-support/Makefile.am
+++ b/libgames-support/Makefile.am
@@ -86,11 +86,17 @@ libgames_support_la_SOURCES += \
games-scores-dialog-private.h \
games-controls.c \
games-controls.h \
- games-setgid-io.c \
- games-setgid-io.h \
games-scores-backend.c \
games-scores-backend.h \
$(NULL)
+
+if ENABLE_SETGID
+libgames_support_la_SOURCES += \
+ games-setgid-io.c \
+ games-setgid-io.h \
+ $(NULL)
+endif # ENABLE_SETGID
+
endif # LIBGAMES_SUPPORT_FULL
if HAVE_GNOME
diff --git a/libgames-support/games-scores-backend.c b/libgames-support/games-scores-backend.c
index 962ea85..c54eca9 100644
--- a/libgames-support/games-scores-backend.c
+++ b/libgames-support/games-scores-backend.c
@@ -30,7 +30,11 @@
#include "games-scores.h"
#include "games-scores-backend.h"
#include "games-runtime.h"
+
+#ifdef ENABLE_SETGID
#include "games-setgid-io.h"
+#error HI HI HI
+#endif
struct _GamesScoresBackendPrivate {
GamesScoreStyle style;
@@ -98,6 +102,8 @@ games_scores_backend_new (GamesScoreStyle style,
return backend;
}
+#ifdef ENABLE_SETGID
+
/* Get a lock on the scores file. Block until it is available.
* This also supplies the file descriptor we need. The return value
* is whether we were succesful or not. */
@@ -145,12 +151,15 @@ games_scores_backend_release_lock (GamesScoresBackend * self)
self->priv->fd = -1;
}
+#endif /* ENABLE_SETGID */
+
/* You can alter the list returned by this function, but you must
* make sure you set it again with the _set_scores method or discard it
* with with the _discard_scores method. Otherwise deadlocks will ensue. */
GList *
games_scores_backend_get_scores (GamesScoresBackend * self)
{
+#ifdef ENABLE_SETGID
gchar *buffer;
gchar *eol;
gchar *scorestr;
@@ -251,11 +260,15 @@ games_scores_backend_get_scores (GamesScoresBackend * self)
/* FIXME: Sort the scores! We shouldn't rely on the file being sorted. */
return self->scores_list;
+#else
+ return NULL;
+#endif /* ENABLE_SETGID */
}
gboolean
games_scores_backend_set_scores (GamesScoresBackend * self, GList * list)
{
+#ifdef ENABLE_SETGID
GList *s;
GamesScore *d;
gchar *buffer;
@@ -310,11 +323,15 @@ games_scores_backend_set_scores (GamesScoresBackend * self, GList * list)
games_scores_backend_release_lock (self);
return TRUE;
-
+#else
+ return FALSE;
+#endif /* ENABLE_SETGID */
}
void
games_scores_backend_discard_scores (GamesScoresBackend * self)
{
+#ifdef ENABLE_SETGID
games_scores_backend_release_lock (self);
+#endif
}
diff --git a/libgames-support/games-scores-backend.h b/libgames-support/games-scores-backend.h
index 22472e7..2247cb5 100644
--- a/libgames-support/games-scores-backend.h
+++ b/libgames-support/games-scores-backend.h
@@ -26,9 +26,12 @@
#include <time.h>
-#include "games-setgid-io.h"
#include "games-score.h"
+#ifdef ENABLE_SETGID
+#include "games-setgid-io.h"
+#endif
+
G_BEGIN_DECLS
#define GAMES_TYPE_SCORES_BACKEND (games_scores_backend_get_type ())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]