diff --git a/slock.c b/slock.c index c43bb00..df4669a 100644 --- a/slock.c +++ b/slock.c @@ -318,9 +318,17 @@ main(int argc, char **argv) { Display *dpy; int screen; - if((argc >= 2) && !strcmp("-p", argv[1])) - g_pw = argv[2]; - else if((argc >= 2) && !strcmp("-v", argv[1])) + if((argc >= 2) && !strcmp("-p", argv[1])) { + g_pw = strdup(argv[2]); + int i = 0; + while (g_pw[i]) { + if (g_pw[i] == '\r' || g_pw[i] == '\n') { + g_pw[i] = '\0'; + break; + } + i++; + } + } else if((argc >= 2) && !strcmp("-v", argv[1])) die("slock-%s, © 2006-2012 Anselm R Garbe\n", VERSION); else if(argc != 1) usage(); diff --git a/slocked b/slocked index 16be08d..26f1049 100755 --- a/slocked +++ b/slocked @@ -16,6 +16,6 @@ fi exec 2> /dev/null pw=$1 if test -z "$pw"; then - pw=$(cat ~/.slock_passwd | xargs printf '%s') + pw=$(cat ~/.slock_passwd) fi exec slock -p "$pw"