~kris/suckless

slock

ref: b52162c32bcb8a8bf64ede7d12bd52fbf1cee2e6 slock/slock.c -rw-r--r-- 20.3 KiB
quick cancel: allow cancelling by key press in addition to mouse movement ref. #11
simplify post-lock cmd and die if it fails

this patch does two things:

0. simplify the code by using posix_spawn()
1. unify the behavior of what happens if the post-lock cmd fails.

currently, if `fork()` fails, slock will die without locking the screen.
HOWEVER if `execvp()` fails it prints a message to stderr (which the
user cannot see since the screen has been locked already) and only exits
the child while the parent locks the screen.

to reproduce:

	# slock some_bin_that_doesnt_exist

this behavior is inconsistent, if the idea is that post-lock cmd is
_not_ important then we shouldn't `die()` on `fork()` failure either.
and if we assume that the post-lock cmd _is_ important, then we should
die on exec failure as well.

this patch assumes the latter and calls `die()` if `posix_spawn()`
fails.

ref.
https://git.suckless.org/slock/commit/a70d5d2429abf8dcb70a8817990975dc9a621d27.html
6020a799 — bakkeby 2 years ago
write version to stdout like the man page says

ref.
https://git.suckless.org/slock/commit/e8bca65d629a4faa89439c9f0e599efb5a259573.html
3131706f — Stein Gunnar Bakkeby 4 years ago
Merge pull request #8 from herrwusel/pam_consistant

Consistent unlock styles with pam and blur patches
8f6f7897 — herrwusel 4 years ago
Consistent unlock styles with pam and blur patches
e71a42ee — bakkeby 4 years ago
Adding background image patch
312951b9 — bakkeby 4 years ago
Proposed change to avoid high CPU usage ref. #7
51d3f49e — bakkeby 4 years ago
Fix for secret password patch compilation error ref. #6
e5e04272 — bakkeby 5 years ago
Adding dwmlogo patch ref. #5
e5a9d853 — bakkeby 5 years ago
Adding auto-timeout patch
35fd53f6 — bakkeby 5 years ago
Adding secret password patch
7dc45011 — bakkeby 5 years ago
Adding failure-command patch
d2be9eb6 — bakkeby 5 years ago
Adding color message patch ref. #3
0bba4617 — bakkeby 6 years ago
Adding alpha patch
74c66223 — bakkeby 6 years ago
Adding blur pixelated screen patch
c07648d3 — bakkeby 6 years ago
Adding keypress_feedback patch
2445d75b — bakkeby 6 years ago
Fix bug in DPMS patch + moved patches.h to patches.def.h to match that of config
4c905a9c — bakkeby 6 years ago
Adding xresources patch
2cf80900 — bakkeby 6 years ago
Added capscolor, control clear, dpms, mediakeys, message, pam auth, quickcancel patches
35633d45 — Tobias Stoeckmann 9 years ago
Properly clear the last entered character

When enter is pressed, passwd[len] will be set to '\0'. Pressing
backspace is supposed to remove the last entered character.

But currently, the clearing has an off-by-one, as in setting
passwd[len] to '\0' just like enter would do.

You can also verify it by imagining len=1 and that it's impossible to
clear passwd[0] by pressing backspace with the current code.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Next