Exemplo n.º 1
0
static void
finalize_chibach() {
  die_unless_initialized();

  debug( "Terminating chibach..." );

  maybe_finalize_openflow_switch_interface();

  finalize_messenger();
  finalize_stat();
  finalize_timer();
  chibach_started = false;
  unlink_pid( get_chibach_pid(), get_chibach_name() );

  unset_chibach_home();
  unset_chibach_tmp();

  xfree( chibach_name );
  chibach_name = NULL;

  xfree( chibach_log );
  chibach_log = NULL;

  initialized = false;
}
Exemplo n.º 2
0
static void
test_unlink_pid_succeed() {
  will_return( mock_unlink, 0 );

  // Test if correctly unlinked.
  char path[] = "/home/yasuhito/trema/tmp/chess.pid";
  expect_string( mock_unlink, pathname, path );

  unlink_pid( "/home/yasuhito/trema/tmp", "chess" );
}
Exemplo n.º 3
0
static void
test_unlink_pid_fail_if_unlink_fail() {
  will_return( mock_unlink, -1 );

  char path[] = "/home/yasuhito/trema/tmp/chess.pid";
  expect_string( mock_unlink, pathname, path );

  expect_string( mock_die, message, "Could not remove a PID file: /home/yasuhito/trema/tmp/chess.pid" );

  expect_assert_failure( unlink_pid( "/home/yasuhito/trema/tmp", "chess" ) );
}