Displaying 1 result from an estimated 1 matches for "lastlog_dir".
Did you mean:
dastlogdir
2014 May 22
0
[PATCH] openssh - loginrec.c - Non-atomic file operations.
...{
- logit("%s: Couldn't stat %s: %s", __func__,
- LASTLOG_FILE, strerror(errno));
- return (0);
- }
- if (S_ISDIR(st.st_mode)) {
- snprintf(lastlog_file, sizeof(lastlog_file), "%s/%s",
- LASTLOG_FILE, li->username);
- } else if (S_ISREG(st.st_mode)) {
+ DIR *lastlog_dir;
+ int dir_fd = -1;
+
+ /* Try to open directory */
+ lastlog_dir = opendir(lastlog_file);
+ if (lastlog_dir != NULL) {
+ /* So. We are directory. */
+ dir_fd = dirfd(lastlog_dir);
+ snprintf(lastlog_file, sizeof(lastlog_file), "/dev/fd/%d/%s",
+ dir_fd, li->username);
+ } else if...