SOURCES: initng-utmpx.patch - fixed utmp patch once for all

glen glen at pld-linux.org
Wed Mar 22 21:33:03 CET 2006


Author: glen                         Date: Wed Mar 22 20:33:03 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- fixed utmp patch once for all

---- Files affected:
SOURCES:
   initng-utmpx.patch (1.4 -> 1.5) 

---- Diffs:

================================================================
Index: SOURCES/initng-utmpx.patch
diff -u SOURCES/initng-utmpx.patch:1.4 SOURCES/initng-utmpx.patch:1.5
--- SOURCES/initng-utmpx.patch:1.4	Sun Feb 26 13:07:41 2006
+++ SOURCES/initng-utmpx.patch	Wed Mar 22 21:32:57 2006
@@ -1,66 +1,26 @@
---- ./plugins/initctl/initng_initctl.c.orig	2005-07-29 00:30:09.000000000 +0300
-+++ ./plugins/initctl/initng_initctl.c	2005-07-29 21:59:20.000000000 +0300
-@@ -32,6 +32,7 @@
- #include <errno.h>
- #include <dirent.h>
- #include <ctype.h>
-+#include <sys/time.h>
- 
- #include "../../src/initng_global.h"
- #include "../../src/process_db.h"
-@@ -44,6 +45,7 @@
- #include "../../src/initng_plugin_hook.h"
- 
- #include <utmp.h>
-+#include <utmpx.h>
- #include "initreq.h"
- 
- #include "initng_initctl.h"
-@@ -235,15 +235,14 @@
- static void makeutmp(int runlevel)
- {
-     D_("Making utmp file for runlevel %d\n", runlevel);
--    struct utmp utmp;
--    time_t t;
-+    struct utmpx utmpx;
- 
-     /*
-      * this is created by bootmisc, if this isn't there we can't set runlevel.
-      */
+it is not known to the initng what utmp file library uses,
+so skip the check and call utmpname()
+
+--- initng-0.6.0RC1/plugins/initctl/initng_initctl.c~	2006-03-22 14:29:42.000000000 +0200
++++ initng-0.6.0RC1/plugins/initctl/initng_initctl.c	2006-03-22 22:14:24.000000000 +0200
+@@ -236,19 +236,7 @@
+     struct utmp utmp;
+     time_t t;
+ 
+-    /*
+-     * this is created by bootmisc, if this isn't there we can't set runlevel.
+-     */
 -    if (access(UTMP_FILE, F_OK) < 0)
-+    if (access(UTMPX_FILE, F_OK) < 0)
-     {
+-    {
 -        F_("/var/run/utmp does not exist, this should be created by bootmisc.i\n");
-+        F_("%s not exist, this should be created by bootmisc.i\n", UTMPX_FILE);
-         return;
-     }
-     /*
-@@ -251,19 +250,18 @@
-        utmpname("/var/run/utmp");
-      */
- 
--    setutent();
--    memset(&utmp, 0, sizeof(utmp));
--    utmp.ut_type = RUN_LVL;
--    utmp.ut_pid = ('#' << 8) + runlevel + '0';
--    time(&t);
--    utmp.ut_time = (int) t;
--    if (pututline(&utmp) == NULL)
-+    setutxent();
-+    memset(&utmpx, 0, sizeof(utmpx));
-+    utmpx.ut_type = RUN_LVL;
-+    utmpx.ut_pid = ('#' << 8) + runlevel + '0';
-+    gettimeofday(&utmpx.ut_tv, NULL);
-+    if (pututxline(&utmpx) == NULL)
-     {
--        F_("pututline failed\n");
--        endutent();
-+        F_("pututxline failed\n");
-+        endutxent();
-         return;
-     }
--    endutent();
-+    endutxent();
-     return;
- }
- 
+-        return;
+-    }
+-    /*
+-       TODO, is this a good idea or a bad idea?
+-       utmpname("/var/run/utmp");
+-     */
+-
++    utmpname(UTMP_FILE);
+     setutent();
+     memset(&utmp, 0, sizeof(utmp));
+     utmp.ut_type = RUN_LVL;
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/initng-utmpx.patch?r1=1.4&r2=1.5&f=u



More information about the pld-cvs-commit mailing list