summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2013-01-18 16:07:20 -0500
committerRay Strode <rstrode@redhat.com>2013-01-22 11:56:26 -0500
commita505c58cee7c1d4f397fb8c0903cc78221c308b4 (patch)
tree86eff58e95b797840a60949e1124fefd3096b815 /common
parent4952f6e5b023428e5f11f763531533c7b262f324 (diff)
downloadgdm-a505c58cee7c1d4f397fb8c0903cc78221c308b4.tar.gz
Log output to systemd journal if available
Previously, we put stuff in /var/log/gdm for the session, and then ~/.cache/gdm/session.log for the user. Now let's use explicit sd_journal_stream_fd() calls. Some adjustments from Ray Strode. https://bugzilla.gnome.org/show_bug.cgi?id=676181
Diffstat (limited to 'common')
-rw-r--r--common/gdm-common.c26
-rw-r--r--common/gdm-common.h2
2 files changed, 28 insertions, 0 deletions
diff --git a/common/gdm-common.c b/common/gdm-common.c
index faab0d7a..ae6129c2 100644
--- a/common/gdm-common.c
+++ b/common/gdm-common.c
@@ -66,6 +66,32 @@ gdm_is_version_unstable (void)
}
gboolean
+gdm_clear_close_on_exec_flag (int fd)
+{
+ int flags;
+
+ if (fd < 0) {
+ return FALSE;
+ }
+
+ flags = fcntl (fd, F_GETFD, 0);
+
+ if (flags < 0) {
+ return FALSE;
+ }
+
+ if ((flags & FD_CLOEXEC) != 0) {
+ int status;
+
+ status = fcntl (fd, F_SETFD, flags & ~FD_CLOEXEC);
+
+ return status != -1;
+ }
+
+ return TRUE;
+}
+
+gboolean
gdm_get_pwent_for_name (const char *name,
struct passwd **pwentp)
{
diff --git a/common/gdm-common.h b/common/gdm-common.h
index 61d2dd30..00012743 100644
--- a/common/gdm-common.h
+++ b/common/gdm-common.h
@@ -45,6 +45,8 @@ int gdm_signal_pid (int pid,
gboolean gdm_get_pwent_for_name (const char *name,
struct passwd **pwentp);
+gboolean gdm_clear_close_on_exec_flag (int fd);
+
const char * gdm_make_temp_dir (char *template);
gboolean gdm_string_hex_encode (const GString *source,