From a1db9e2dae19d7969474e35a969ceb0800339a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 27 Jun 2017 09:57:03 +0200 Subject: [PATCH] Check return value of chdir(2) where it makes sense --- abduco.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/abduco.c b/abduco.c index 057873f..9552529 100644 --- a/abduco.c +++ b/abduco.c @@ -544,7 +544,8 @@ static int session_comparator(const struct dirent **a, const struct dirent **b) static int list_session(void) { if (!create_socket_dir(&sockaddr)) return 1; - chdir(sockaddr.sun_path); + if (chdir(sockaddr.sun_path) == -1) + die("list-session"); struct dirent **namelist; int n = scandir(sockaddr.sun_path, &namelist, session_filter, session_comparator); if (n < 0)