mirror of
https://github.com/javalsai/lidm.git
synced 2025-07-03 14:25:03 +02:00
dev: remove strcln in favor of strdup
This commit is contained in:
parent
aa1cafe743
commit
cbb3aa3910
@ -11,7 +11,6 @@
|
|||||||
enum keys find_keyname(char*);
|
enum keys find_keyname(char*);
|
||||||
enum keys find_ansi(char*);
|
enum keys find_ansi(char*);
|
||||||
void read_press(u_char*, char*);
|
void read_press(u_char*, char*);
|
||||||
void strcln(char** dest, const char* source);
|
|
||||||
|
|
||||||
struct Vector {
|
struct Vector {
|
||||||
uint32_t length;
|
uint32_t length;
|
||||||
|
@ -174,7 +174,8 @@ bool launch(char* user, char* passwd, struct session session, void (*cb)(void),
|
|||||||
if (pid == 0) { // child
|
if (pid == 0) { // child
|
||||||
char* term = NULL;
|
char* term = NULL;
|
||||||
char* getterm = getenv("TERM");
|
char* getterm = getenv("TERM");
|
||||||
if (getterm != NULL) strcln(&term, getterm);
|
// TODO: handle malloc error
|
||||||
|
if (getterm != NULL) term = strdup(getterm);
|
||||||
if (clearenv() != 0) {
|
if (clearenv() != 0) {
|
||||||
print_errno("clearenv");
|
print_errno("clearenv");
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
|
@ -46,7 +46,7 @@ struct Vector get_human_users() {
|
|||||||
|
|
||||||
struct passwd* NULLABLE pwd;
|
struct passwd* NULLABLE pwd;
|
||||||
while ((pwd = getpwent()) != NULL) {
|
while ((pwd = getpwent()) != NULL) {
|
||||||
if (strcmp(pwd->pw_dir, "/home/") != 0) continue;
|
if (!pwd->pw_dir || strcmp(pwd->pw_dir, "/home/") != 0) continue;
|
||||||
|
|
||||||
struct user* user_i = malloc(sizeof(struct user));
|
struct user* user_i = malloc(sizeof(struct user));
|
||||||
if (user_i == NULL) continue; // malloc error
|
if (user_i == NULL) continue; // malloc error
|
||||||
|
@ -11,11 +11,6 @@
|
|||||||
|
|
||||||
static int selret_magic();
|
static int selret_magic();
|
||||||
|
|
||||||
void strcln(char** dest, const char* source) {
|
|
||||||
*dest = malloc(strlen(source) + sizeof(char));
|
|
||||||
strcpy(*dest, source);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum keys find_keyname(char* name) {
|
enum keys find_keyname(char* name) {
|
||||||
for (size_t i = 0; i < sizeof(key_mappings) / sizeof(key_mappings[0]); i++) {
|
for (size_t i = 0; i < sizeof(key_mappings) / sizeof(key_mappings[0]); i++) {
|
||||||
if (strcmp(key_names[i], name) == 0) return (enum keys)i;
|
if (strcmp(key_names[i], name) == 0) return (enum keys)i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user