[PATCH 2/3] dix: Close protocol.txt after we're done loading extension names

Keith Packard keithp at keithp.com
Wed Sep 10 16:00:01 PDT 2014


Don't leave this file open during the whole server execution process;
close it once all of the extensions are initialized.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 dix/main.c         | 2 ++
 dix/registry.c     | 4 ++++
 include/registry.h | 1 +
 3 files changed, 7 insertions(+)

diff --git a/dix/main.c b/dix/main.c
index 7427e08..930a85f 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -269,6 +269,8 @@ dix_main(int argc, char *argv[], char *envp[])
 
         dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
 
+        dixCloseRegistry();
+
 #ifdef PANORAMIX
         if (!noPanoramiXExtension) {
             if (!PanoramiXCreateConnectionBlock()) {
diff --git a/dix/registry.c b/dix/registry.c
index 82a3340..8b76d56 100644
--- a/dix/registry.c
+++ b/dix/registry.c
@@ -309,7 +309,11 @@ dixFreeRegistry(void)
     resources = NULL;
 
     nmajor = nevent = nerror = nresource = 0;
+}
 
+void
+dixCloseRegistry(void)
+{
     if (fh) {
 	fclose(fh);
         fh = NULL;
diff --git a/include/registry.h b/include/registry.h
index 96be87a..4e54bf6 100644
--- a/include/registry.h
+++ b/include/registry.h
@@ -45,6 +45,7 @@ extern _X_EXPORT const char *LookupResourceName(RESTYPE rtype);
  */
 extern _X_EXPORT void dixResetRegistry(void);
 extern _X_EXPORT void dixFreeRegistry(void);
+extern _X_EXPORT void dixCloseRegistry(void);
 
 #else                           /* XREGISTRY */
 
-- 
2.0.1



More information about the xorg-devel mailing list