File 0476-snmp-agent-Fix-dets-bchunk-return-handling.patch of Package erlang

From 8ebc60a857a52fe73e408d2588b2b43e1c3c3f18 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Tue, 3 Sep 2019 11:05:44 +0200
Subject: [PATCH] [snmp|agent] Fix dets bchunk return handling

The only thing from the ticket that was easily mapped on todays
version of snmp (there has been a lot of changes to the app
since this ticket was written 7 years ago) was this dets related
issue (a clear bug).

OTP-10400
---
 lib/snmp/src/agent/snmpa_general_db.erl | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/snmp/src/agent/snmpa_general_db.erl b/lib/snmp/src/agent/snmpa_general_db.erl
index 431302b6cc..0d4e39f56d 100644
--- a/lib/snmp/src/agent/snmpa_general_db.erl
+++ b/lib/snmp/src/agent/snmpa_general_db.erl
@@ -534,16 +534,16 @@ dets_backup(close, _Cont, _Name, B) ->
     ok;
 dets_backup(read, Cont1, Name, B) ->
     case dets:bchunk(Name, Cont1) of
+	{error, _} = ERROR ->
+	    ERROR;
+	'$end_of_table' ->
+	    dets:close(B),
+	    end_of_input;
 	{Cont2, Data} ->
 	    F = fun(Arg) ->
 			dets_backup(Arg, Cont2, Name, B)
 		end,
-	    {Data, F};
-	'$end_of_table' ->
-	    dets:close(B),
-	    end_of_input;
-	Error ->
-	    Error
+	    {Data, F}
     end.
 
 
-- 
2.16.4

openSUSE Build Service is sponsored by