From 665ce3e215b9b47a251b4433fe776d42072d9e9b Mon Sep 17 00:00:00 2001
From: Martin Stiborsky <martin.stiborsky@gmail.com>
Date: Tue, 6 Jan 2015 00:02:23 +0100
Subject: [PATCH] getpwuid call moved

---
 i3lock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/i3lock.c b/i3lock.c
index 4f9d5d4..942781a 100644
--- a/i3lock.c
+++ b/i3lock.c
@@ -661,7 +661,7 @@ static void raise_loop(xcb_window_t window) {
 }
 
 int main(int argc, char *argv[]) {
-    struct passwd *pw = getpwuid(getuid());
+    struct passwd *pw;
     char *username;
     char *image_path = NULL;
     int ret;
@@ -687,7 +687,7 @@ int main(int argc, char *argv[]) {
         {NULL, no_argument, NULL, 0}
     };
 
-    if (pw == NULL)
+    if ((pw = getpwuid(getuid())) == NULL)
         err(EXIT_FAILURE, "getpwuid() failed");
     if ((username = pw->pw_name) == NULL)
         errx(EXIT_FAILURE, "pw->pw_name is NULL.\n");