useradd does not create the files if they don't exist, but if they exist
it will reset user data even if the data did not exist before creating
a hole and an explicitly zero'd data point resulting (especially for
high UIDs) in a lot of zeros ending up in containers and tarballs.
struct faillog fl;
int fd;
off_t offset_uid = (off_t) (sizeof fl) * uid;
+ struct stat st;
- if (access (FAILLOG_FILE, F_OK) != 0) {
+ if (stat (FAILLOG_FILE, &st) != 0 || st.st_size <= offset_uid) {
return;
}
int fd;
off_t offset_uid = (off_t) (sizeof ll) * uid;
uid_t max_uid;
+ struct stat st;
- if (access (LASTLOG_FILE, F_OK) != 0) {
+ if (stat (LASTLOG_FILE, &st) != 0 || st.st_size <= offset_uid) {
return;
}