mirror of
https://github.com/javalsai/lidm.git
synced 2025-07-03 14:25:03 +02:00
chore: better error handling print on chdir
This commit is contained in:
parent
ed80b4b7c4
commit
2ba49042ab
@ -1,4 +1,3 @@
|
||||
#include <errno.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <security/pam_misc.h>
|
||||
@ -61,10 +60,9 @@ void *shmalloc(size_t size) {
|
||||
}
|
||||
|
||||
void moarEnv(char *user, struct session session, struct passwd *pw) {
|
||||
if (chdir(pw->pw_dir) == -1) {
|
||||
fprintf(stderr, "can't change directory to %s: %s\n", pw->pw_dir,
|
||||
strerror(errno));
|
||||
}
|
||||
if (chdir(pw->pw_dir) == -1)
|
||||
print_errno("can't chdir to user home");
|
||||
|
||||
setenv("HOME", pw->pw_dir, true);
|
||||
setenv("USER", pw->pw_name, true);
|
||||
setenv("SHELL", pw->pw_shell, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user