Re: [systemd-devel] [PATCH] switch_root: do not fail, if base_filesystem_create() failed

2014-11-06 Thread Harald Hoyer
On 04.11.2014 19:17, Daniel Buch wrote:
 I think you might want to cast it to avoid compiler warning. Like:
 (void) base_filesystem_create()
 
 Den 04/11/2014 17.36 skrev har...@redhat.com mailto:har...@redhat.com:
 
 From: Harald Hoyer har...@redhat.com mailto:har...@redhat.com
 
 Not all switch roots are like base_filesystem_create() wants them
 to look like. They might even boot, if they are RO and don't have the FS
 layout. Just ignore the error and switch_root nevertheless.
 
 base_filesystem_create() should have logged, what went wrong.
 ---
  src/shared/switch-root.c | 6 +-
  1 file changed, 1 insertion(+), 5 deletions(-)
 
 diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c
 index bac0e5c..673f8a7 100644
 --- a/src/shared/switch-root.c
 +++ b/src/shared/switch-root.c
 @@ -103,11 +103,7 @@ int switch_root(const char *new_root, const char
 *oldroot, bool detach_oldroot,
  }
  }
 
 -r = base_filesystem_create(new_root);
 -if (r  0) {
 -log_error(Failed to create the base filesystem: %s,
 strerror(-r));
 -return r;
 -}
 +base_filesystem_create(new_root);
 
  if (chdir(new_root)  0) {
  log_error(Failed to change directory to %s: %m, 
 new_root);
 --

Thanks! Pushed with (void)

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] switch_root: do not fail, if base_filesystem_create() failed

2014-11-04 Thread harald
From: Harald Hoyer har...@redhat.com

Not all switch roots are like base_filesystem_create() wants them
to look like. They might even boot, if they are RO and don't have the FS
layout. Just ignore the error and switch_root nevertheless.

base_filesystem_create() should have logged, what went wrong.
---
 src/shared/switch-root.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c
index bac0e5c..673f8a7 100644
--- a/src/shared/switch-root.c
+++ b/src/shared/switch-root.c
@@ -103,11 +103,7 @@ int switch_root(const char *new_root, const char *oldroot, 
bool detach_oldroot,
 }
 }
 
-r = base_filesystem_create(new_root);
-if (r  0) {
-log_error(Failed to create the base filesystem: %s, 
strerror(-r));
-return r;
-}
+base_filesystem_create(new_root);
 
 if (chdir(new_root)  0) {
 log_error(Failed to change directory to %s: %m, new_root);
-- 
2.1.0

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] switch_root: do not fail, if base_filesystem_create() failed

2014-11-04 Thread Daniel Buch
I think you might want to cast it to avoid compiler warning. Like:
(void) base_filesystem_create()
Den 04/11/2014 17.36 skrev har...@redhat.com:

 From: Harald Hoyer har...@redhat.com

 Not all switch roots are like base_filesystem_create() wants them
 to look like. They might even boot, if they are RO and don't have the FS
 layout. Just ignore the error and switch_root nevertheless.

 base_filesystem_create() should have logged, what went wrong.
 ---
  src/shared/switch-root.c | 6 +-
  1 file changed, 1 insertion(+), 5 deletions(-)

 diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c
 index bac0e5c..673f8a7 100644
 --- a/src/shared/switch-root.c
 +++ b/src/shared/switch-root.c
 @@ -103,11 +103,7 @@ int switch_root(const char *new_root, const char
 *oldroot, bool detach_oldroot,
  }
  }

 -r = base_filesystem_create(new_root);
 -if (r  0) {
 -log_error(Failed to create the base filesystem: %s,
 strerror(-r));
 -return r;
 -}
 +base_filesystem_create(new_root);

  if (chdir(new_root)  0) {
  log_error(Failed to change directory to %s: %m,
 new_root);
 --
 2.1.0

 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] switch_root: do not fail, if base_filesystem_create() failed

2014-09-03 Thread harald
From: Harald Hoyer har...@redhat.com

Not all switch roots are like base_filesystem_create() wants them
to look like. They might even boot, if they are RO and don't have the FS
layout. Just output the error and switch_root nevertheless.
---
 src/shared/switch-root.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c
index 5f075e6..fcd3420 100644
--- a/src/shared/switch-root.c
+++ b/src/shared/switch-root.c
@@ -107,7 +107,7 @@ int switch_root(const char *new_root, const char *oldroot, 
bool detach_oldroot,
 r = base_filesystem_create(new_root);
 if (r  0) {
 log_error(Failed to create the base filesystem: %s, 
strerror(-r));
-return r;
+r = 0;
 }
 
 if (chdir(new_root)  0) {
-- 
2.1.0

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] switch_root: do not fail, if base_filesystem_create() failed

2014-09-03 Thread Lennart Poettering
On Wed, 03.09.14 13:34, har...@redhat.com (har...@redhat.com) wrote:

 From: Harald Hoyer har...@redhat.com
 
 Not all switch roots are like base_filesystem_create() wants them
 to look like. They might even boot, if they are RO and don't have the FS
 layout. Just output the error and switch_root nevertheless.
 ---
  src/shared/switch-root.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c
 index 5f075e6..fcd3420 100644
 --- a/src/shared/switch-root.c
 +++ b/src/shared/switch-root.c
 @@ -107,7 +107,7 @@ int switch_root(const char *new_root, const char 
 *oldroot, bool detach_oldroot,
  r = base_filesystem_create(new_root);
  if (r  0) {
  log_error(Failed to create the base filesystem: %s, 
 strerror(-r));
 -return r;
 +r = 0;

As discussed on phone: this call appears to log on its own anyway,
there's no point in doing this here again. We really shouldn't log
about errors that happen multiple times.

Hence: just eat up the exit code entirely here, ignore any failures,
don't assign the return value to r, just invoke the function without
caring for the return value. The call logs on its own already, and
what it does should not be reason to fail this early.


Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel