Sophie

Sophie

distrib > Mageia > 7 > armv7hl > by-pkgid > eb284da017ca08c3a9a32c8fd2ca634c > files > 2

chkconfig-1.11-2.mga7.src.rpm

--- chkconfig-1.11/leveldb.c.orig	2018-12-29 03:06:59.536048290 -0500
+++ chkconfig-1.11/leveldb.c	2018-12-29 03:09:45.201550246 -0500
@@ -19,11 +19,8 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <glob.h>
-#include <libgen.h>
 #include <libintl.h>
 #include <locale.h>
-#include <selinux/label.h>
-#include <selinux/selinux.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -41,47 +38,6 @@
 
 #include "leveldb.h"
 
-int selinux_restore(const char *name) {
-    struct selabel_handle *hnd = NULL;
-    struct stat buf;
-    security_context_t newcon = NULL;
-    int r = -1;
-
-    hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0);
-    if (hnd == NULL)
-        goto out;
-
-    r = stat(name, &buf);
-    if (r < 0)
-        goto out;
-
-    r = selabel_lookup_raw(hnd, &newcon, name, buf.st_mode);
-    if (r < 0)
-        goto out;
-
-    r = setfilecon_raw(name, newcon);
-    if (r < 0)
-        goto out;
-
-    r = 0;
-
-out:
-    if (hnd)
-        selabel_close(hnd);
-    if (newcon)
-        freecon(newcon);
-
-    /* Lets ignore any errors when selinux is disabled.
-     * We still want to run the previous code though,
-     * since we only need selinux policy.
-     * Selinux itself can be turned off.
-     */
-    if (!is_selinux_enabled())
-        return 0;
-
-    return r;
-}
-
 int parseLevels(char *str, int emptyOk) {
     char *chptr = str;
     int rc = 0;
@@ -848,7 +804,6 @@ int setXinetdService(struct service s, i
     char *buf, *ptr, *tmp;
     struct stat sb;
     mode_t mode;
-    int r;
 
     if (on == -1) {
         on = s.enabled ? 1 : 0;
@@ -896,11 +851,7 @@ int setXinetdService(struct service s, i
     }
     close(newfd);
     unlink(oldfname);
-    r = rename(newfname, oldfname);
-    if (selinux_restore(oldfname) != 0)
-        fprintf(stderr, _("Unable to set selinux context for %s: %s\n"),
-                oldfname, strerror(errno));
-    return (r);
+    return (rename(newfname,oldfname));
 }
 
 int doSetService(struct service s, int level, int on) {
@@ -933,12 +884,11 @@ int doSetService(struct service s, int l
 
 int systemdIsInit() {
     char *path = realpath("/sbin/init", NULL);
-    char *base = NULL;
+    char *base ;
 
     if (!path)
         return 0;
     base = basename(path);
-    puts(base);
     if (!base)
         return 0;
     if (strcmp(base, "systemd"))