Deleted Added
full compact
getlogin.c (200142) getlogin.c (254463)
1/*
2 * Copyright (c) 1988, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#if defined(LIBC_SCCS) && !defined(lint)
31static char sccsid[] = "@(#)getlogin.c 8.1 (Berkeley) 6/4/93";
32#endif /* LIBC_SCCS and not lint */
33#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1988, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#if defined(LIBC_SCCS) && !defined(lint)
31static char sccsid[] = "@(#)getlogin.c 8.1 (Berkeley) 6/4/93";
32#endif /* LIBC_SCCS and not lint */
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/lib/libc/gen/getlogin.c 200142 2009-12-05 19:04:21Z ed $");
34__FBSDID("$FreeBSD: head/lib/libc/gen/getlogin.c 254463 2013-08-17 19:24:58Z jilles $");
35
36#include <sys/param.h>
37#include <errno.h>
38#include <pwd.h>
39#include <stdio.h>
40#include <string.h>
41#include <unistd.h>
42#include "namespace.h"
43#include <pthread.h>
44#include "un-namespace.h"
45
46#include "libc_private.h"
47
48#define THREAD_LOCK() if (__isthreaded) _pthread_mutex_lock(&logname_mutex)
49#define THREAD_UNLOCK() if (__isthreaded) _pthread_mutex_unlock(&logname_mutex)
50
51extern int _getlogin(char *, int);
52
35
36#include <sys/param.h>
37#include <errno.h>
38#include <pwd.h>
39#include <stdio.h>
40#include <string.h>
41#include <unistd.h>
42#include "namespace.h"
43#include <pthread.h>
44#include "un-namespace.h"
45
46#include "libc_private.h"
47
48#define THREAD_LOCK() if (__isthreaded) _pthread_mutex_lock(&logname_mutex)
49#define THREAD_UNLOCK() if (__isthreaded) _pthread_mutex_unlock(&logname_mutex)
50
51extern int _getlogin(char *, int);
52
53int _logname_valid; /* known to setlogin() */
53int _logname_valid __hidden; /* known to setlogin() */
54static pthread_mutex_t logname_mutex = PTHREAD_MUTEX_INITIALIZER;
55
56static char *
57getlogin_basic(int *status)
58{
59 static char logname[MAXLOGNAME];
60
61 if (_logname_valid == 0) {

--- 40 unchanged lines hidden ---
54static pthread_mutex_t logname_mutex = PTHREAD_MUTEX_INITIALIZER;
55
56static char *
57getlogin_basic(int *status)
58{
59 static char logname[MAXLOGNAME];
60
61 if (_logname_valid == 0) {

--- 40 unchanged lines hidden ---