[systemd-commits] 2 commits - src/core src/libsystemd-daemon src/readahead src/udev
Zbigniew JÄdrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Mon Mar 11 15:05:35 PDT 2013
src/core/smack-setup.c | 24 +++++++++++++++---------
src/libsystemd-daemon/sd-daemon.c | 20 ++++++++++----------
src/readahead/sd-readahead.c | 14 +++++++-------
src/udev/cdrom_id/cdrom_id.c | 4 ----
4 files changed, 32 insertions(+), 30 deletions(-)
New commits:
commit fea7838e7e0b2724f5e0bc028121a08b42995045
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Mon Mar 11 18:03:13 2013 -0400
core/smack: downgrade info to debug
BogdanR> I think it's cool it supports SMACK and that it encourages
them to use a propper mount point for smackfs but I don't
think it's cool that it's printing on the screen even when
I parse quiet to the kernel that "SMACK support is not
enabled ...".
diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
index 88e6437..d0f1ac0 100644
--- a/src/core/smack-setup.c
+++ b/src/core/smack-setup.c
@@ -50,22 +50,24 @@ int smack_setup(void) {
smack = fopen("/sys/fs/smackfs/load2", "we");
if (!smack) {
- log_info("Smack is not enabled in the kernel, not loading access rules.");
+ if (errno == ENOENT)
+ log_debug("Smack is not enabled in the kernel, not loading access rules.");
+ else
+ log_warning("Failed to open /sys/fs/smackfs/load2: %m");
return 0;
}
/* write rules to load2 from every file in the directory */
dir = opendir(ACCESSES_D_PATH);
if (!dir) {
- log_info("Smack access rules directory not found: " ACCESSES_D_PATH);
+ log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
+ "Opening Smack access rules directory "
+ ACCESSES_D_PATH ": %m");
return 0;
}
dfd = dirfd(dir);
- if (dfd < 0) {
- log_error("Smack access rules directory " ACCESSES_D_PATH " not opened: %m");
- return 0;
- }
+ assert(dfd >= 0);
FOREACH_DIRENT(entry, dir, return 0) {
_cleanup_fclose_ FILE *policy = NULL;
@@ -73,20 +75,24 @@ int smack_setup(void) {
pol = openat(dfd, entry->d_name, O_RDONLY|O_CLOEXEC);
if (pol < 0) {
- log_error("Smack access rule file %s not opened: %m", entry->d_name);
+ log_error("Smack access rule file %s not opened: %m",
+ entry->d_name);
continue;
}
policy = fdopen(pol, "re");
if (!policy) {
- log_error("Smack access rule file %s not opened: %m", entry->d_name);
+ log_error("Smack access rule file %s not opened: %m",
+ entry->d_name);
continue;
}
pol = -1;
/* load2 write rules in the kernel require a line buffered stream */
- FOREACH_LINE(buf, policy, log_error("Failed to read from Smack access rule file %s: %m", entry->d_name)) {
+ FOREACH_LINE(buf, policy,
+ log_error("Failed to read from Smack access rule file %s: %m",
+ entry->d_name)) {
fputs(buf, smack);
fflush(smack);
}
commit 24be98227483baf67094fa95b5633594446cd21a
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Mon Mar 11 18:03:13 2013 -0400
Remove or indent #define GNU_SOURCE
It is only needed in files designed to be usable in standalone
compilation. In those files the #ifdefinery is indented. When
compiling in-tree, GNU_SOURCE is always defined, so remove one
definition.
diff --git a/src/libsystemd-daemon/sd-daemon.c b/src/libsystemd-daemon/sd-daemon.c
index 80aadf7..5b92e2e 100644
--- a/src/libsystemd-daemon/sd-daemon.c
+++ b/src/libsystemd-daemon/sd-daemon.c
@@ -25,7 +25,7 @@
***/
#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
+# define _GNU_SOURCE
#endif
#include <sys/types.h>
@@ -33,9 +33,9 @@
#include <sys/socket.h>
#include <sys/un.h>
#ifdef __BIONIC__
-#include <linux/fcntl.h>
+# include <linux/fcntl.h>
#else
-#include <sys/fcntl.h>
+# include <sys/fcntl.h>
#endif
#include <netinet/in.h>
#include <stdlib.h>
@@ -48,21 +48,21 @@
#include <limits.h>
#if defined(__linux__)
-#include <mqueue.h>
+# include <mqueue.h>
#endif
#include "sd-daemon.h"
#if (__GNUC__ >= 4)
-#ifdef SD_EXPORT_SYMBOLS
+# ifdef SD_EXPORT_SYMBOLS
/* Export symbols */
-#define _sd_export_ __attribute__ ((visibility("default")))
-#else
+# define _sd_export_ __attribute__ ((visibility("default")))
+# else
/* Don't export the symbols */
-#define _sd_export_ __attribute__ ((visibility("hidden")))
-#endif
+# define _sd_export_ __attribute__ ((visibility("hidden")))
+# endif
#else
-#define _sd_export_
+# define _sd_export_
#endif
_sd_export_ int sd_listen_fds(int unset_environment) {
diff --git a/src/readahead/sd-readahead.c b/src/readahead/sd-readahead.c
index d48cd76..4a096ee 100644
--- a/src/readahead/sd-readahead.c
+++ b/src/readahead/sd-readahead.c
@@ -25,7 +25,7 @@
***/
#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
+# define _GNU_SOURCE
#endif
#include <unistd.h>
@@ -38,15 +38,15 @@
#include "sd-readahead.h"
#if (__GNUC__ >= 4)
-#ifdef SD_EXPORT_SYMBOLS
+# ifdef SD_EXPORT_SYMBOLS
/* Export symbols */
-#define _sd_export_ __attribute__ ((visibility("default")))
-#else
+# define _sd_export_ __attribute__ ((visibility("default")))
+# else
/* Don't export the symbols */
-#define _sd_export_ __attribute__ ((visibility("hidden")))
-#endif
+# define _sd_export_ __attribute__ ((visibility("hidden")))
+# endif
#else
-#define _sd_export_
+# define _sd_export_
#endif
static int touch(const char *path) {
diff --git a/src/udev/cdrom_id/cdrom_id.c b/src/udev/cdrom_id/cdrom_id.c
index b659cc3..1ad0459 100644
--- a/src/udev/cdrom_id/cdrom_id.c
+++ b/src/udev/cdrom_id/cdrom_id.c
@@ -17,10 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE 1
-#endif
-
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
More information about the systemd-commits
mailing list