summaryrefslogtreecommitdiffstats
path: root/src/pwcache.c
Commit message (Collapse)AuthorAgeFilesLines
* pwcache: Fix uninitialized pointers on OpenBSDTavian Barnes2024-01-021-4/+4
| | | | | | | | | | | | | POSIX specifies that the get{pw,gr}*_r() functions store a NULL pointer to *result on error. However, OpenBSD does not always do this[1][2]: > if (bufsize < GETGR_R_SIZE_MAX) > return ERANGE; Work around it by explicitly initializing ret to NULL. [1]: https://github.com/openbsd/src/blob/e4829a9cc666f01ca5062d7fc15c20ab2d69229e/lib/libc/gen/getgrent.c#L135-L136 [2]: https://github.com/openbsd/src/blob/e4829a9cc666f01ca5062d7fc15c20ab2d69229e/lib/libc/gen/getgrent.c#L183-L184
* Formatting fixesTavian Barnes2023-09-271-1/+0
|
* pwcache: Don't use _SC_GET{PW,GR}_R_SIZE_MAXTavian Barnes2023-08-311-23/+9
| | | | | They tend be 1024, which is a lot of memory per user/group. 128 is usually enough, so start there instead.
* pwcache: Arena-allocate struct passwd/groupTavian Barnes2023-08-311-54/+80
|
* alloc: New header for memory allocation utilitiesTavian Barnes2023-06-201-2/+3
|
* config: Provide <stdalign.h> and <stdbool.h>Tavian Barnes2023-05-111-1/+1
| | | | In anticipation of C23, since those headers won't be necessary any more.
* Replace license boilerplate with SPDX tagsTavian Barnes2023-01-251-15/+2
| | | | | | | And while I'm at it, remove years from copyright declarations. Link: https://spdx.dev/about/ Link: https://daniel.haxx.se/blog/2023/01/08/copyright-without-years/
* ctx: Flush the user/group caches when executing commandsTavian Barnes2022-11-091-24/+22
| | | | | | This fixes (admittedly uncommon) commands like $ bfs -nouser -exec add-missing-user.sh {} \;
* pwcache: Fill the user/group caches lazilyTavian Barnes2022-11-091-196/+126
| | | | | | | Iterating all the users/groups can be expensive, especially with NSS. Android has so many that it doesn't even return them all from get{pw,gr}ent() for performance reasons, leading to incorrect behaviour of -user/-group/etc.
* Source / Include Folder (#88)トトも2022-04-161-0/+293
Moved Source Files Into `src` Folder