aboutsummaryrefslogtreecommitdiff
path: root/i3-nagbar
diff options
context:
space:
mode:
authorhwangcc <hwangcc@csie.nctu.edu.tw>2015-03-24 20:57:06 +0800
committerhwangcc <hwangcc@csie.nctu.edu.tw>2015-03-29 10:22:34 +0800
commit42515308e72e4ea6f6b49508c1ba286263dded64 (patch)
tree0d45efcea26bd355a3cd808462850723bd99a193 /i3-nagbar
parent822cd3bf1b95a61667bfa186ff2093ecd317a3a6 (diff)
downloadi3-42515308e72e4ea6f6b49508c1ba286263dded64.tar.gz
i3-42515308e72e4ea6f6b49508c1ba286263dded64.zip
Add a safe wrapper for write and fix some warnings
1. Add a function writeall and make swrite wrap that function. Use either writeall or swrite, depending on whether we want to exit on errors or not. 2. Fix warnings when compiling with a higher optimisation level. (CFLAGS ?= -pipe -O3 -march=native -mtune=native -freorder-blocks-and-partition) Signed-off-by: hwangcc <hwangcc@csie.nctu.edu.tw>
Diffstat (limited to 'i3-nagbar')
-rw-r--r--i3-nagbar/main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/i3-nagbar/main.c b/i3-nagbar/main.c
index b501ff6a..91de317f 100644
--- a/i3-nagbar/main.c
+++ b/i3-nagbar/main.c
@@ -164,7 +164,9 @@ static void handle_button_release(xcb_connection_t *conn, xcb_button_release_eve
char *link_path;
char *exe_path = get_exe_path(argv0);
sasprintf(&link_path, "%s.nagbar_cmd", script_path);
- symlink(exe_path, link_path);
+ if (symlink(exe_path, link_path) == -1) {
+ err(EXIT_FAILURE, "Failed to symlink %s to %s", link_path, exe_path);
+ }
char *terminal_cmd;
sasprintf(&terminal_cmd, "i3-sensible-terminal -e %s", link_path);