X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Futil.c;h=0edd471a2c247b7448ee54392dcecc86a08ae4c1;hb=419b73be9e6e502760878f8372a7d51975c0cdce;hp=c891a6bc5c9678c998c4cf2a7cca348d40b56cfa;hpb=971864062219bdb4b4ce24fdcf007f2f05251a8a;p=i3%2Fi3 diff --git a/src/util.c b/src/util.c index c891a6bc..0edd471a 100644 --- a/src/util.c +++ b/src/util.c @@ -4,7 +4,7 @@ * vim:ts=4:sw=4:expandtab * * i3 - an improved dynamic tiling window manager - * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) + * © 2009 Michael Stapelberg and contributors (see also: LICENSE) * * util.c: Utility functions, which can be useful everywhere within i3 (see * also libi3). @@ -122,7 +122,7 @@ void exec_i3_utility(char *name, char *argv[]) { /* if the script is not in path, maybe the user installed to a strange * location and runs the i3 binary with an absolute path. We use * argv[0]’s dirname */ - char *pathbuf = strdup(start_argv[0]); + char *pathbuf = sstrdup(start_argv[0]); char *dir = dirname(pathbuf); sasprintf(&migratepath, "%s/%s", dir, name); argv[0] = migratepath; @@ -222,7 +222,7 @@ char *store_restart_layout(void) { char *filenamecopy = sstrdup(filename); char *base = dirname(filenamecopy); DLOG("Creating \"%s\" for storing the restart layout\n", base); - if (!mkdirp(base)) + if (mkdirp(base, DEFAULT_DIR_MODE) != 0) ELOG("Could not create \"%s\" for storing the restart layout, layout will be lost.\n", base); free(filenamecopy); @@ -276,7 +276,7 @@ void i3_restart(bool forget_layout) { int num_args; for (num_args = 0; start_argv[num_args] != NULL; num_args++) ; - char **new_argv = scalloc((num_args + 3) * sizeof(char *)); + char **new_argv = scalloc(num_args + 3, sizeof(char *)); /* copy the arguments, but skip the ones we'll replace */ int write_index = 0;