summaryrefslogtreecommitdiff
path: root/sysdeps/osf1/open_suid.c
diff options
context:
space:
mode:
authorMartin Baulig <martin@home-of-linux.org>1998-08-07 12:59:00 +0000
committerMartin Baulig <martin@src.gnome.org>1998-08-07 12:59:00 +0000
commita510ed127175d2f0cb04a7c5c76dfe71e9ac3ad9 (patch)
treefac819e144a625cd80ed18cbee7bd858478fbfe3 /sysdeps/osf1/open_suid.c
parent3b4e0378f962a485e7980e5089b6dcfee0298c5d (diff)
downloadlibgtop-a510ed127175d2f0cb04a7c5c76dfe71e9ac3ad9.tar.gz
Removed. New files. Added `libgtop_server'; this has been moved here from
1998-08-07 Martin Baulig <martin@home-of-linux.org> * src/server: Removed. * src/daemon/{server, version}.c: New files. * src/daemon/Makefile.am: Added `libgtop_server'; this has been moved here from `src/server' since it shares some source code files with the `libgtop_daemon'. * LIBGTOP-VERSION: Added `LIBGTOP_SERVER_VERSION'. * src/daemon/gnuserv.c, lib/open.c: Improved version check between client and server. * include/glibtop/output.h: Removed. * sysdeps/stub_suid: New directory. This is mainly used as example for people porting libgtop to other systems. * sysdeps/common/sysdeps_suid.c: New file. Defines `glibtop_init_hook_p'. * sysdeps/osf1/*.c (glibtop_init_<no-suid-feature>_s): New functions. (glibtop_init_<suid-feature>_p): New functions.
Diffstat (limited to 'sysdeps/osf1/open_suid.c')
-rw-r--r--sysdeps/osf1/open_suid.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sysdeps/osf1/open_suid.c b/sysdeps/osf1/open_suid.c
index f2e7a353..8eba2d8a 100644
--- a/sysdeps/osf1/open_suid.c
+++ b/sysdeps/osf1/open_suid.c
@@ -27,20 +27,31 @@
#include <unistd.h>
#include <sys/types.h>
-/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
-
/* !!! THIS FUNCTION RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
void
glibtop_init_p (glibtop *server, const unsigned long features,
const unsigned flags)
{
+ glibtop_init_func_t *init_fkt;
+
if (server == NULL)
glibtop_error_r (NULL, "glibtop_init_p (server == NULL)");
- glibtop_open_p (server, "glibtop", features, flags);
+ /* Do the initialization, but only if not already initialized. */
+
+ if ((server->flags & _GLIBTOP_INIT_STATE_INIT) == 0) {
+ glibtop_open_p (server, "glibtop", features, flags);
+
+ for (init_fkt = _glibtop_init_hook_p; *init_fkt; init_fkt++)
+ (*init_fkt) (server);
+
+ server->flags |= _GLIBTOP_INIT_STATE_INIT;
+ }
}
+/* !!! THIS FUNCTION RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
+
void
glibtop_open_p (glibtop *server, const char *program_name,
const unsigned long features, const unsigned flags)