LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File 1071-Return-error-when-unable-to-make-dir.patch of Package erlang (Project home:Ledest:erlang:20)

From e46c14eab593f9c4cc4cf0efe6f3753964035b22 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20Meadows-J=C3=B6nsson?=
 <eric.meadows.jonsson@gmail.com>
Date: Wed, 25 Oct 2017 21:11:28 +0200
Subject: [PATCH 1/2] Return error when unable to make dir

---
 lib/stdlib/src/erl_tar.erl | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/stdlib/src/erl_tar.erl b/lib/stdlib/src/erl_tar.erl
index 76f0b38108..48bbd38f9b 100644
--- a/lib/stdlib/src/erl_tar.erl
+++ b/lib/stdlib/src/erl_tar.erl
@@ -1650,8 +1650,12 @@ write_file(Name, Bin) ->
     case file:write_file(Name, Bin) of
         ok -> ok;
         {error,enoent} ->
-            ok = make_dirs(Name, file),
-            write_file(Name, Bin);
+            case make_dirs(Name, file) of
+                ok ->
+                    write_file(Name, Bin);
+                {error,Reason} ->
+                    throw({error, Reason})
+            end;
         {error,Reason} ->
             throw({error, Reason})
     end.
-- 
2.16.1