/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
openbox.c for the Openbox window manager
/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
openbox.c for the Openbox window manager
/* initialize the locale */
if (!setlocale(LC_ALL, ""))
/* initialize the locale */
if (!setlocale(LC_ALL, ""))
bindtextdomain(PACKAGE_NAME, LOCALEDIR);
bind_textdomain_codeset(PACKAGE_NAME, "UTF-8");
textdomain(PACKAGE_NAME);
g_set_prgname(argv[0]);
bindtextdomain(PACKAGE_NAME, LOCALEDIR);
bind_textdomain_codeset(PACKAGE_NAME, "UTF-8");
textdomain(PACKAGE_NAME);
g_set_prgname(argv[0]);
- chdir(g_get_home_dir());
+ if (chdir(g_get_home_dir()) == -1)
+ g_warning("Unable to change to home directory (%s): %s",
+ g_get_home_dir(), g_strerror(errno));
if (fcntl(ConnectionNumber(ob_display), F_SETFD, 1) == -1)
ob_exit_with_error("Failed to set display as close-on-exec.");
if (fcntl(ConnectionNumber(ob_display), F_SETFD, 1) == -1)
ob_exit_with_error("Failed to set display as close-on-exec.");
ob_main_loop_signal_add(ob_main_loop, SIGINT, signal_handler, NULL, NULL);
ob_main_loop_signal_add(ob_main_loop, SIGHUP, signal_handler, NULL, NULL);
ob_main_loop_signal_add(ob_main_loop, SIGPIPE, signal_handler, NULL, NULL);
ob_main_loop_signal_add(ob_main_loop, SIGINT, signal_handler, NULL, NULL);
ob_main_loop_signal_add(ob_main_loop, SIGHUP, signal_handler, NULL, NULL);
ob_main_loop_signal_add(ob_main_loop, SIGPIPE, signal_handler, NULL, NULL);
if (g_shell_parse_argv(restart_path, &argcp, &argvp, &err)) {
execvp(argvp[0], argvp);
g_strfreev(argvp);
} else {
g_warning("failed to execute '%s': %s", restart_path,
err->message);
if (g_shell_parse_argv(restart_path, &argcp, &argvp, &err)) {
execvp(argvp[0], argvp);
g_strfreev(argvp);
} else {
g_warning("failed to execute '%s': %s", restart_path,
err->message);
- execlp(argv[0], g_path_get_basename(argv[0])); /* last resort */
+ execlp(argv[0], g_path_get_basename(argv[0]),
+ (char *)NULL); /* last resort */
ob_debug("Caught signal %d. Exiting.\n", signal);
/* TERM and INT return a 0 code */
ob_exit(!(signal == SIGTERM || signal == SIGINT));
ob_debug("Caught signal %d. Exiting.\n", signal);
/* TERM and INT return a 0 code */
ob_exit(!(signal == SIGTERM || signal == SIGINT));
static void print_version()
{
g_print("Openbox %s\n", PACKAGE_VERSION);
static void print_version()
{
g_print("Openbox %s\n", PACKAGE_VERSION);
g_print("This program comes with ABSOLUTELY NO WARRANTY.\n");
g_print("This is free software, and you are welcome to redistribute it\n");
g_print("under certain conditions. See the file COPYING for details.\n\n");
g_print("This program comes with ABSOLUTELY NO WARRANTY.\n");
g_print("This is free software, and you are welcome to redistribute it\n");
g_print("under certain conditions. See the file COPYING for details.\n\n");
g_print(" --version Display the version and exit\n");
g_print(" --sync Run in synchronous mode (this is slow and "
"meant for\n"
g_print(" --version Display the version and exit\n");
g_print(" --sync Run in synchronous mode (this is slow and "
"meant for\n"
g_print(" --debug Display debugging output\n");
g_print("\nPlease report bugs at %s\n\n", PACKAGE_BUGREPORT);
}
g_print(" --debug Display debugging output\n");
g_print("\nPlease report bugs at %s\n\n", PACKAGE_BUGREPORT);
}