anchor.diff:      ?log_error("Got unexpected exit signal from port: ~p. Exiting.", [Exit]),
       {stop, Reason, State}.
   
  -handle_call(is_active, _From, State) ->
  -    {reply, is_port(State#state.port), State};
  -
  -handle_call(activate, _From, #state{port = P} = State) when is_port(P) ->
  -    {reply, {error, already_active}, State};
  -handle_call(activate, _From, #state{port = {inactive, Params}} = State) ->
  +handle_call(is_active, _From, #state{port = Port} = State) ->
  +    {reply, Port =/= undefined, State};
  +
  +handle_call(activate, _From, #state{port = undefined,
  +                                    params = Params} = State) ->
       State2 = State#state{port = open_port(Params)},
  -    {reply, ok, State2}.
  +    {reply, ok, State2};
  +handle_call(activate, _From, State) ->
  +    {reply, {error, already_active}, State}.
   
   handle_cast(unhandled, unhandled) ->
       erlang:exit(unhandled).
  
positive.code:             Port ! {self(), {command, Data}}
      end,
      Port.
  
negative.code:     State1 = log(State),
      {noreply, State1};
  handle_info({_Port, {exit_status, Status}}, State) ->
      ns_crash_log:record_crash({port_name(State),
                                 Status,
                                 string:join(ringbuffer:to_list(State#state.messages), "\n")}),
      {stop, {abnormal, Status}, State};
  