summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorwes <wes@FreeBSD.org>1999-11-28 22:41:38 +0000
committerwes <wes@FreeBSD.org>1999-11-28 22:41:38 +0000
commit6ed770d48894580ab774368b42e9851442d48788 (patch)
tree91300c093c38e7ad15cc925769d6ade89ac8b63d /lib/libc
parent1de8077aec0521daa28eba6c7da66bbd2a3af021 (diff)
downloadFreeBSD-src-6ed770d48894580ab774368b42e9851442d48788.zip
FreeBSD-src-6ed770d48894580ab774368b42e9851442d48788.tar.gz
Provide the getlogin_r function.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/getlogin.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/libc/gen/getlogin.c b/lib/libc/gen/getlogin.c
index 96a3fdd..044689d 100644
--- a/lib/libc/gen/getlogin.c
+++ b/lib/libc/gen/getlogin.c
@@ -29,6 +29,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
#if defined(LIBC_SCCS) && !defined(lint)
@@ -60,3 +62,19 @@ getlogin()
}
return (*logname ? logname : (char *)NULL);
}
+
+
+char *
+getlogin_r(char *logname, int namelen)
+{
+ if (_logname_valid == 0) {
+#ifdef __NETBSD_SYSCALLS
+ if (__getlogin(logname, namelen - 1) < 0)
+#else
+ if (_getlogin(logname, namelen) < 0)
+#endif
+ return ((char *)NULL);
+ _logname_valid = 1;
+ }
+ return (*logname ? logname : (char *)NULL);
+}
OpenPOWER on IntegriCloud