[PATCH 2/3] Rename getpw() and pws to gethash() and hash

From: FRIGN <dev_AT_frign.de>
Date: Sun, 11 Sep 2016 23:10:57 +0200

---
 slock.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/slock.c b/slock.c
index 83f6810..e231ce6 100644
--- a/slock.c
+++ b/slock.c
_AT_@ -85,7 +85,7 @@ dontkillme(void)
 #endif
 
 static const char *
-getpw(void)
+gethash(void)
 {
 	const char *rval;
 	struct passwd *pw;
_AT_@ -124,7 +124,7 @@ getpw(void)
 
 static void
 readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
-       const char *pws)
+       const char *hash)
 {
 	char buf[32], passwd[256], *encrypted;
 	int num, screen, running, failure;
_AT_@ -161,10 +161,10 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
 			case XK_Return:
 				passwd[len] = 0;
 				errno = 0;
-				if (!(encrypted = crypt(passwd, pws)))
+				if (!(encrypted = crypt(passwd, hash)))
 					fprintf(stderr, "slock: crypt: %s\n", strerror(errno));
 				else
-					running = !!strcmp(encrypted, pws);
+					running = !!strcmp(encrypted, hash);
 				if (running) {
 					XBell(dpy, 100);
 					failure = True;
_AT_@ -322,7 +322,7 @@ main(int argc, char **argv) {
 	struct group *grp;
 	uid_t duid;
 	gid_t dgid;
-	const char *pws;
+	const char *hash;
 	Display *dpy;
 	int s, nlocks, nscreens;
 
_AT_@ -350,8 +350,8 @@ main(int argc, char **argv) {
 	dontkillme();
 #endif
 
-	pws = getpw();
-	if (strlen(pws) < 2)
+	hash = gethash();
+	if (strlen(hash) < 2)
 		die("slock: failed to get user password hash.\n");
 
 	if (!(dpy = XOpenDisplay(NULL)))
_AT_@ -405,7 +405,7 @@ main(int argc, char **argv) {
 	}
 
 	/* everything is now blank. Wait for the correct password */
-	readpw(dpy, &rr, locks, nscreens, pws);
+	readpw(dpy, &rr, locks, nscreens, hash);
 
 	/* password ok, unlock everything and quit */
 	cleanup(&dpy, &locks, &nscreens);
-- 
2.7.3
--Multipart=_Sun__11_Sep_2016_23_24_20_+0200_yLsZjR=N1XirPpcZ
Content-Type: text/x-diff;
 name="0003-Stop-using-USER-for-shadow-entries.patch"
Content-Disposition: attachment;
 filename="0003-Stop-using-USER-for-shadow-entries.patch"
Content-Transfer-Encoding: 7bit
Received on Mon Sep 17 2001 - 00:00:00 CEST

This archive was generated by hypermail 2.3.0 : Sun Sep 11 2016 - 23:36:14 CEST