[elbe-devel] [PATCH v2 2/6] Fix None case for Filesystem write_file mode
Torben Hohn
torben.hohn at linutronix.de
Tue May 21 10:33:45 CEST 2019
On Fri, May 17, 2019 at 04:36:55PM +0200, dion at linutronix.de wrote:
> From: Olivier Dion <dion at linutronix.de>
>
> Both methods 'write_file' and 'append_file' change the mode of the target
> file after the operation. But, we don't always want to change the
> mode of the file.
>
> Thus, if the mode is 'None', the file's mode is unchanged.
>
> Signed-off-by: Olivier Dion <dion at linutronix.de>
Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>
> ---
> elbepack/filesystem.py | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/elbepack/filesystem.py b/elbepack/filesystem.py
> index 978d32a1..cc7d08f5 100644
> --- a/elbepack/filesystem.py
> +++ b/elbepack/filesystem.py
> @@ -152,7 +152,8 @@ class Filesystem(object):
> f = self.open(path, "w")
> f.write(cont)
> f.close()
> - self.chmod(path, mode)
> + if mode is not None:
> + self.chmod(path, mode)
>
> def append_file(self, path, content, mode=None):
> f = self.open(path, "a")
> --
> 2.21.0
>
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel
--
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99
Hinweise zum Datenschutz finden Sie hier (Informations on data privacy
can be found here): https://linutronix.de/kontakt/Datenschutz.php
Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen |
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner
More information about the elbe-devel
mailing list