diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2018-07-31 14:52:40 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2018-07-31 14:54:21 +0000 |
commit | a2fd4c4e40fff79d43c13c3d4e919596667e3526 (patch) | |
tree | 1b7c2dc9ee704a6b93b7dedb4bbf4e94eef81dd7 /testing/accountsservice/musl-fgetspent_r.patch | |
parent | 506c4f449ff86d8256c26a9af65e3fdd041f6bf5 (diff) | |
download | aports-a2fd4c4e40fff79d43c13c3d4e919596667e3526.tar.bz2 aports-a2fd4c4e40fff79d43c13c3d4e919596667e3526.tar.xz |
testing/accountsservice: upgrade to 0.6.50, modernize
Diffstat (limited to 'testing/accountsservice/musl-fgetspent_r.patch')
-rw-r--r-- | testing/accountsservice/musl-fgetspent_r.patch | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/testing/accountsservice/musl-fgetspent_r.patch b/testing/accountsservice/musl-fgetspent_r.patch new file mode 100644 index 0000000000..f5046d47c6 --- /dev/null +++ b/testing/accountsservice/musl-fgetspent_r.patch @@ -0,0 +1,34 @@ +diff --git a/src/daemon.c b/src/daemon.c +index 312394a..e7b3c58 100644 +--- a/src/daemon.c ++++ b/src/daemon.c +@@ -140,6 +140,28 @@ error_get_type (void) + #define MAX_LOCAL_USERS 50 + #endif + ++#ifndef __GLIBC__ ++ /* Musl libc does not support fgetspent_r(), write own ++ * wrapper ++ */ ++static int fgetspent_r(FILE *fp, struct spwd *spbuf, char *buf, size_t buflen, struct spwd **spbufp) { ++ struct spwd *shadow_entry = fgetspent(fp); ++ if(!shadow_entry) ++ return -1; ++ size_t namplen = strlen(shadow_entry->sp_namp); ++ size_t pwdplen = strlen(shadow_entry->sp_pwdp); ++ ++ if(namplen + pwdplen + 2 > buflen) ++ return -1; ++ ++ *spbufp = memcpy(spbuf, shadow_entry, sizeof(struct spwd)); ++ spbuf->sp_namp = strncpy(buf, shadow_entry->sp_namp, namplen + 1); ++ spbuf->sp_pwdp = strncpy(buf + namplen + 1, shadow_entry->sp_pwdp, pwdplen + 1); ++ ++ return 0; ++} ++#endif ++ + static struct passwd * + entry_generator_fgetpwent (Daemon *daemon, + GHashTable *users, + |