From 6f32add9a75efb180e462ffbdb0b080bc88088e3 Mon Sep 17 00:00:00 2001 From: Joe Marcus Clarke Date: Mon, 24 Mar 2008 03:52:36 +0000 Subject: The FreeBSD GNOME team is proud to annunce the release of GNOME 2.22.0 for FreeBSD. The official GNOME 2.22 release notes can be found at http://library.gnome.org/misc/release-notes/2.22/ . On the FreeBSD front, this release features an updated hal port with support for video4linux devices, DRM (Direct Rendering), and better support of removable media. Work is also underway to tie webkit more closely into GNOME. As part of the GNOME 2.22 upgrade, GStreamer received a rather large upgrade as well. Be sure to consult UPDATING on the proper steps to upgrade all of your GNOME ports. This release would not have been possible without the contributions and testing efforts of the following people: Pawel Worach kan edwin Peter Ulrich Kruppa J. W. Ballantine Yasuda Keisuke Andriy Gapon --- .../files/patch-src_polkit_polkit-sysdeps.c | 187 +++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 sysutils/policykit/files/patch-src_polkit_polkit-sysdeps.c (limited to 'sysutils/policykit/files/patch-src_polkit_polkit-sysdeps.c') diff --git a/sysutils/policykit/files/patch-src_polkit_polkit-sysdeps.c b/sysutils/policykit/files/patch-src_polkit_polkit-sysdeps.c new file mode 100644 index 000000000000..c8e4935f105a --- /dev/null +++ b/sysutils/policykit/files/patch-src_polkit_polkit-sysdeps.c @@ -0,0 +1,187 @@ +--- src/polkit/polkit-sysdeps.c.orig 2007-11-28 16:26:14.000000000 -0500 ++++ src/polkit/polkit-sysdeps.c 2008-01-02 00:42:47.000000000 -0500 +@@ -39,7 +39,6 @@ + #include + #include + #include +-#include + #include + + #include "polkit-sysdeps.h" +@@ -82,7 +81,11 @@ polkit_sysdeps_get_start_time_for_pid (p + start_time = 0; + contents = NULL; + ++#ifdef __FreeBSD__ ++ filename = kit_strdup_printf ("/proc/%d/status", pid); ++#else + filename = kit_strdup_printf ("/proc/%d/stat", pid); ++#endif + if (filename == NULL) { + errno = ENOMEM; + goto out; +@@ -93,6 +96,35 @@ polkit_sysdeps_get_start_time_for_pid (p + goto out; + } + ++#ifdef __FreeBSD__ ++ tokens = kit_strsplit (contents, ' ', &num_tokens); ++ if (tokens == NULL) ++ goto out; ++ if (num_tokens < 8) { ++ kit_strfreev (tokens); ++ goto out; ++ } ++ ++ p = kit_strdup (tokens[7]); ++ kit_strfreev (tokens); ++ ++ tokens = kit_strsplit (p, ',', &num_tokens); ++ if (tokens == NULL) ++ goto out; ++ if (num_tokens >= 1) { ++ start_time = strtoll (tokens[0], &endp, 10); ++ if (endp == tokens[0]) { ++ kit_strfreev (tokens); ++ goto out; ++ } ++ } else { ++ kit_strfreev (tokens); ++ goto out; ++ } ++ ++ kit_strfreev (tokens); ++#else ++ + /* start time is the 19th token after the '(process name)' entry */ + + p = strchr (contents, ')'); +@@ -118,6 +150,7 @@ polkit_sysdeps_get_start_time_for_pid (p + } + + kit_strfreev (tokens); ++#endif + + out: + kit_free (filename); +@@ -153,7 +186,11 @@ polkit_sysdeps_get_exe_for_pid (pid_t pi + + ret = 0; + ++#ifdef __FreeBSD__ ++ snprintf (proc_name, sizeof (proc_name), "/proc/%d/file", pid); ++#else + snprintf (proc_name, sizeof (proc_name), "/proc/%d/exe", pid); ++#endif + ret = readlink (proc_name, out_buf, buf_size - 1); + if (ret == -1) { + strncpy (out_buf, "(unknown)", buf_size); +@@ -166,6 +203,108 @@ out: + return ret; + } + ++#ifndef HAVE_GETLINE ++/* Taken from GNU sed. */ ++/* Read up to (and including) a '\n' from STREAM into *LINEPTR ++ (and null-terminate it). *LINEPTR is a pointer returned from malloc (or ++ NULL), pointing to *N characters of space. It is realloc'd as ++ necessary. Returns the number of characters read (not including the ++ null terminator), or -1 on error or EOF. */ ++ ++ssize_t ++polkit_sysdeps_getline (char **lineptr, size_t *n, FILE *stream) ++{ ++ char *line, *p; ++ long size, copy; ++ ++ if (lineptr == NULL || n == NULL) { ++ errno = EINVAL; ++ return (ssize_t) -1; ++ } ++ ++ if (ferror (stream)) ++ return (ssize_t) -1; ++ ++ /* Make sure we have a line buffer to start with. */ ++ if (*lineptr == NULL || *n < 2) /* !seen and no buf yet need 2 chars. */ { ++#ifndef MAX_CANON ++#define MAX_CANON 256 ++#endif ++ if (!*lineptr) ++ line = (char *) malloc (MAX_CANON); ++ else ++ line = (char *) realloc (*lineptr, MAX_CANON); ++ if (line == NULL) ++ return (ssize_t) -1; ++ *lineptr = line; ++ *n = MAX_CANON; ++ } ++ ++ line = *lineptr; ++ size = *n; ++ ++ copy = size; ++ p = line; ++ ++ while (1) { ++ long len; ++ ++ while (--copy > 0) { ++ int c = getc (stream); ++ ++ if (c == EOF) ++ goto lose; ++ else if ((*p++ = c) == '\n') ++ goto win; ++ } ++ ++ /* Need to enlarge the line buffer. */ ++ len = p - line; ++ size *= 2; ++ line = (char *) realloc (line, size); ++ if (line == NULL) ++ goto lose; ++ *lineptr = line; ++ *n = size; ++ p = line + len; ++ copy = size - len; ++ } ++ ++lose: ++ if (p == *lineptr) ++ return (ssize_t) -1; ++ ++ /* Return a partial line since we got an error in the middle. */ ++win: ++ *p = '\0'; ++ return p - *lineptr; ++} ++#else ++ssize_t ++polkit_sysdeps_getline (char **lineptr, size_t *n, FILE *stream) ++{ ++ return getline (lineptr, n, stream); ++} ++#endif ++ ++#ifndef HAVE_CLEARENV ++extern char **environ; ++int ++polkit_sysdeps_clearenv (void) ++{ ++ if (environ != NULL) { ++ environ[0] = NULL; ++ } ++ return 0; ++} ++#else ++int ++polkit_sysdeps_clearenv (void) ++{ ++ return clearenv (); ++} ++#endif ++ + #ifdef POLKIT_BUILD_TESTS + + static polkit_bool_t -- cgit v1.2.3