[systemd-commits] 3 commits - src/fstab-generator src/network src/shared
Zbigniew Jędrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Sat Mar 21 08:56:53 PDT 2015
src/fstab-generator/fstab-generator.c | 23 ++++++++++++++++-------
src/network/networkd.c | 10 ++++------
src/shared/mkdir.c | 6 ++----
3 files changed, 22 insertions(+), 17 deletions(-)
New commits:
commit e0952d9d021234e79f3a70f33a9e5d201872a417
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sat Mar 21 11:31:16 2015 -0400
fstab-generator: ignore invalid swap priority
A failed priority is not something worth stopping boot over. Most people
have only one swap device, in which case priority is irrelevant, and even
if there is more than one swap device, they are all usable, and ignoring the
priority field should only result in some loss of performance.
The kernel will report the priority as -1 if not set, so it's easy for
people to make this mistake.
https://bugzilla.redhat.com/show_bug.cgi?id=1204336
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index ccc7c6e..2ece12f 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -53,9 +53,10 @@ static int add_swap(
bool noauto,
bool nofail) {
- _cleanup_free_ char *name = NULL, *unit = NULL, *lnk = NULL;
+ _cleanup_free_ char *name = NULL, *unit = NULL, *lnk = NULL, *filtered = NULL;
_cleanup_fclose_ FILE *f = NULL;
int r, pri = -1;
+ const char *opts;
assert(what);
assert(me);
@@ -70,9 +71,17 @@ static int add_swap(
return 0;
}
- r = fstab_find_pri(me->mnt_opts, &pri);
- if (r < 0)
- return log_error_errno(r, "Failed to parse priority: %m");
+ opts = me->mnt_opts;
+ r = fstab_find_pri(opts, &pri);
+ if (r < 0) {
+ log_error_errno(r, "Failed to parse priority, ignoring: %m");
+
+ /* Remove invalid pri field */
+ r = fstab_filter_options(opts, "pri\0", NULL, NULL, &filtered);
+ if (r < 0)
+ return log_error_errno(r, "Failed to parse options: %m");
+ opts = filtered;
+ }
name = unit_name_from_path(what, ".swap");
if (!name)
@@ -105,15 +114,15 @@ static int add_swap(
if (pri >= 0)
fprintf(f, "Priority=%i\n", pri);
- if (!isempty(me->mnt_opts) && !streq(me->mnt_opts, "defaults"))
- fprintf(f, "Options=%s\n", me->mnt_opts);
+ if (!isempty(opts) && !streq(opts, "defaults"))
+ fprintf(f, "Options=%s\n", opts);
r = fflush_and_check(f);
if (r < 0)
return log_error_errno(r, "Failed to write unit file %s: %m", unit);
/* use what as where, to have a nicer error message */
- r = generator_write_timeouts(arg_dest, what, what, me->mnt_opts, NULL);
+ r = generator_write_timeouts(arg_dest, what, what, opts, NULL);
if (r < 0)
return r;
commit 8bde1d0c9d322f3b9a8dd24cfc8417b9231314d8
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Mon Mar 16 11:35:12 2015 -0400
networkd: use LOG_WARN not LOG_ERR for non-fatal errors
diff --git a/src/network/networkd.c b/src/network/networkd.c
index 723d105..543a4e4 100644
--- a/src/network/networkd.c
+++ b/src/network/networkd.c
@@ -53,21 +53,19 @@ int main(int argc, char *argv[]) {
* watches in. */
r = mkdir_safe_label("/run/systemd/netif", 0755, uid, gid);
if (r < 0)
- log_error_errno(r, "Could not create runtime directory: %m");
+ log_warning_errno(r, "Could not create runtime directory: %m");
r = mkdir_safe_label("/run/systemd/netif/links", 0755, uid, gid);
if (r < 0)
- log_error_errno(r, "Could not create runtime directory 'links': %m");
+ log_warning_errno(r, "Could not create runtime directory 'links': %m");
r = mkdir_safe_label("/run/systemd/netif/leases", 0755, uid, gid);
if (r < 0)
- log_error_errno(r, "Could not create runtime directory 'leases': %m");
+ log_warning_errno(r, "Could not create runtime directory 'leases': %m");
r = mkdir_safe_label("/run/systemd/netif/lldp", 0755, uid, gid);
if (r < 0)
- log_error("Could not create runtime directory 'lldp': %s",
- strerror(-r));
-
+ log_warning_errno(r, "Could not create runtime directory 'lldp': %m");
r = drop_privileges(uid, gid,
(1ULL << CAP_NET_ADMIN) |
commit 2e6534a9a5ad5f02a37e7dca878c521f38df8456
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Mon Mar 16 11:34:39 2015 -0400
shared/mkdir: do not set errno in addition to return value
All callers look at the return value anyway.
diff --git a/src/shared/mkdir.c b/src/shared/mkdir.c
index b280618..7ee4546 100644
--- a/src/shared/mkdir.c
+++ b/src/shared/mkdir.c
@@ -41,10 +41,8 @@ int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, mkd
(st.st_mode & 0700) > (mode & 0700) ||
(uid != UID_INVALID && st.st_uid != uid) ||
(gid != GID_INVALID && st.st_gid != gid) ||
- !S_ISDIR(st.st_mode)) {
- errno = EEXIST;
- return -errno;
- }
+ !S_ISDIR(st.st_mode))
+ return -EEXIST;
return 0;
}
More information about the systemd-commits
mailing list