--- /usr/local/lib/erlang/lib/sasl-2.0.1/src/alarm_handler.erl	Fri Jun 24 13:52:00 2005
+++ /home/serge/tmp/alarm_handler.erl	Thu Jul 28 13:02:33 2005
@@ -3,16 +3,16 @@
 %% compliance with the License. You should have received a copy of the
 %% Erlang Public License along with this software. If not, it can be
 %% retrieved via the world wide web at http://www.erlang.org/.
-%% 
+%%
 %% Software distributed under the License is distributed on an "AS IS"
 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 %% the License for the specific language governing rights and limitations
 %% under the License.
-%% 
+%%
 %% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
 %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
 %% AB. All Rights Reserved.''
-%% 
+%%
 %%     $Id$
 %%
 -module(alarm_handler).
@@ -73,13 +73,23 @@
 %% Default Alarm handler
 %%-----------------------------------------------------------------
 init(_) -> {ok, []}.
-    
-handle_event({set_alarm, Alarm}, Alarms)->
-    error_logger:info_report([{alarm_handler, {set, Alarm}}]),
-    {ok, [Alarm | Alarms]};
+
+handle_event({set_alarm, {AlarmId, _} = Alarm}, Alarms)->
+    case lists:keysearch(AlarmId, 1, Alarms) of
+    {value, _} ->
+        {ok, Alarms};
+    false ->
+        error_logger:info_report([{alarm_handler, {set, Alarm}}]),
+        {ok, [Alarm | Alarms]}
+    end;
 handle_event({clear_alarm, AlarmId}, Alarms)->
-    error_logger:info_report([{alarm_handler, {clear, AlarmId}}]),
-    {ok, lists:keydelete(AlarmId, 1, Alarms)};
+    case lists:keysearch(AlarmId, 1, Alarms) of
+    {value, _} ->
+        error_logger:info_report([{alarm_handler, {clear, AlarmId}}]),
+        {ok, lists:keydelete(AlarmId, 1, Alarms)};
+    false ->
+        {ok, Alarms}
+    end;
 handle_event(_, Alarms)->
     {ok, Alarms}.
 
