diff options
author | Dmitry Marakasov <amdmi3@FreeBSD.org> | 2015-09-22 03:46:11 +0000 |
---|---|---|
committer | Dmitry Marakasov <amdmi3@FreeBSD.org> | 2015-09-22 03:46:11 +0000 |
commit | 4dd29f9c7ea4162b9f0dc0693ad0f098437192c9 (patch) | |
tree | d0f441dd6fa605abb9c80cb80b70ff332cd41b30 /misc/orville-write/files/patch-getutent.c | |
parent | - Switch to options helpers (diff) |
- Drop 8.x support
Approved by: portmgr blanket
Notes
Notes:
svn path=/head/; revision=397528
Diffstat (limited to 'misc/orville-write/files/patch-getutent.c')
-rw-r--r-- | misc/orville-write/files/patch-getutent.c | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/misc/orville-write/files/patch-getutent.c b/misc/orville-write/files/patch-getutent.c new file mode 100644 index 000000000000..acbdef74c917 --- /dev/null +++ b/misc/orville-write/files/patch-getutent.c @@ -0,0 +1,106 @@ +--- getutent.c.orig 2000-01-31 22:02:45.000000000 -0800 ++++ getutent.c 2010-02-02 22:53:30.347068707 -0800 +@@ -20,18 +20,8 @@ + { + if (utmp.state == 0) + { +- if ((utmp.fd= open(utmp.fname ? utmp.fname : _PATH_UTMP, +- O_RDONLY)) < 0) +- { +- utmp.state= -1; +- return -1; +- } +- else +- { + utmp.state= 1; +- fcntl(utmp.fd, F_SETFD, 1); /* Close over execs */ + return 0; +- } + } + } + +@@ -42,8 +32,7 @@ + void endutent() + { + if (utmp.state == 1) +- close(utmp.fd); +- utmp.state= 0; ++ utmp.state= 0; + } + + +@@ -52,8 +41,7 @@ + + void setutent() + { +- if (utmp.state == 1) +- lseek(utmp.fd, 0L, 0); ++ ; + } + + +@@ -75,9 +63,9 @@ + /* GETUTENT - Read the next entry from the utmp file into static storage. + */ + +-struct utmp *getutent() ++struct utmpx *getutent() + { +-static struct utmp ut; ++static struct utmpx *ut; + + switch (utmp.state) + { +@@ -85,11 +73,11 @@ + openut(); + /* Drop through */ + case 1: +- if (read(utmp.fd, &ut, sizeof(struct utmp)) == sizeof(struct utmp)) +- return &ut; ++ if ((ut = getutxent()) != NULL) ++ return ut; + /* Drop through */ + default: +- return (struct utmp *)NULL; ++ return (struct utmpx *)NULL; + } + } + +@@ -100,9 +88,9 @@ + * we conform with Linux and Solaris. + */ + +-struct utmp *getutline(const struct utmp *in) ++struct utmpx *getutline(const struct utmpx *in) + { +-static struct utmp ut; ++static struct utmpx *ut; + + switch (utmp.state) + { +@@ -110,20 +98,20 @@ + openut(); + /* Drop through */ + case 1: +- while (read(utmp.fd, &ut, sizeof(struct utmp)) == sizeof(struct utmp)) ++ while ((ut = getutxent()) != NULL) + { + if ( + #if defined(USER_PROCESS) && defined(LOGIN_PROCESS) +- (ut.ut_type == USER_PROCESS || ut.ut_type == LOGIN_PROCESS) && ++ (ut->ut_type == USER_PROCESS || ut->ut_type == LOGIN_PROCESS) && + #endif +- !strncmp(ut.ut_line, in->ut_line, UT_LINESIZE)) ++ !strncmp(ut->ut_line, in->ut_line, sizeof(ut->ut_line))) + { +- return &ut; ++ return ut; + } + } + /* Drop through */ + default: +- return (struct utmp *)NULL; ++ return (struct utmpx *)NULL; + } + } + |