#include "shash.h"
#include "util.h"
+#define THIS_MODULE VLM_fatal_signal
+#include "vlog.h"
+
/* Signals to catch. */
static const int fatal_signals[] = { SIGTERM, SIGINT, SIGHUP, SIGALRM };
fatal_signal_unblock();
}
+/* Like fatal_signal_remove_file_to_unlink(), but also unlinks 'file'.
+ * Returns 0 if successful, otherwise a positive errno value. */
+int
+fatal_signal_unlink_file_now(const char *file)
+{
+ int error = unlink(file) ? errno : 0;
+ if (error) {
+ VLOG_WARN("could not unlink \"%s\" (%s)", file, strerror(error));
+ }
+
+ fatal_signal_remove_file_to_unlink(file);
+
+ return error;
+}
+
static void
unlink_files(void *aux UNUSED)
{
/*
- * Copyright (c) 2008 Nicira Networks.
+ * Copyright (c) 2008, 2009 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* exit(). */
void fatal_signal_add_file_to_unlink(const char *);
void fatal_signal_remove_file_to_unlink(const char *);
+int fatal_signal_unlink_file_now(const char *);
/* Interface for other code that catches one of our signals and needs to pass
* it through. */
}
close(server->fd);
- unlink(server->path);
- fatal_signal_remove_file_to_unlink(server->path);
+ fatal_signal_unlink_file_now(server->path);
free(server->path);
free(server);
}
unixctl_client_destroy(struct unixctl_client *client)
{
if (client) {
- unlink(client->bind_path);
- fatal_signal_remove_file_to_unlink(client->bind_path);
+ fatal_signal_unlink_file_now(client->bind_path);
free(client->bind_path);
free(client->connect_path);
fclose(client->stream);
VLOG_MODULE(executer)
VLOG_MODULE(ezio_term)
VLOG_MODULE(fail_open)
+VLOG_MODULE(fatal_signal)
VLOG_MODULE(fault)
VLOG_MODULE(flow)
VLOG_MODULE(in_band)