Merge branch 'master' into next
This commit is contained in:
@ -1731,13 +1731,10 @@ void cmd_reload(I3_CMD) {
|
||||
void cmd_restart(I3_CMD) {
|
||||
LOG("restarting i3\n");
|
||||
ipc_shutdown();
|
||||
unlink(config.ipc_socket_path);
|
||||
/* We need to call this manually since atexit handlers don’t get called
|
||||
* when exec()ing */
|
||||
purge_zerobyte_logfile();
|
||||
/* The unlink call is intentionally after the purge_zerobyte_logfile() so
|
||||
* that the latter does not remove the directory yet. We need to store the
|
||||
* restart layout state in there. */
|
||||
unlink(config.ipc_socket_path);
|
||||
i3_restart(false);
|
||||
|
||||
// XXX: default reply for now, make this a better reply
|
||||
|
@ -41,7 +41,7 @@ static void set_nonblock(int sockfd) {
|
||||
* Emulates mkdir -p (creates any missing folders)
|
||||
*
|
||||
*/
|
||||
static bool mkdirp(const char *path) {
|
||||
bool mkdirp(const char *path) {
|
||||
if (mkdir(path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == 0)
|
||||
return true;
|
||||
if (errno != ENOENT) {
|
||||
|
@ -249,6 +249,15 @@ char *store_restart_layout(void) {
|
||||
filename = resolve_tilde(config.restart_state_path);
|
||||
}
|
||||
|
||||
/* create the directory, it could have been cleaned up before restarting or
|
||||
* may not exist at all in case it was user-specified. */
|
||||
char *filenamecopy = sstrdup(filename);
|
||||
char *base = dirname(filenamecopy);
|
||||
DLOG("Creating \"%s\" for storing the restart layout\n", base);
|
||||
if (!mkdirp(base))
|
||||
ELOG("Could not create \"%s\" for storing the restart layout, layout will be lost.\n", base);
|
||||
free(filenamecopy);
|
||||
|
||||
int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
|
||||
if (fd == -1) {
|
||||
perror("open()");
|
||||
|
Reference in New Issue
Block a user