mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-20 16:22:38 -05:00
revert to cuserid for systems where getlogin fails
This commit is contained in:
parent
9d864d8b00
commit
18cd0ba37f
11
pklock.c
11
pklock.c
@ -33,6 +33,7 @@ int gethostname(char *name, int namelen)
|
||||
}
|
||||
#endif
|
||||
|
||||
char *cuserid( char *retbuf) ; /* should have been declared in stdio.h */
|
||||
|
||||
|
||||
/**********************
|
||||
@ -84,7 +85,15 @@ char *dolock( const char *fname)
|
||||
}
|
||||
if ((n = read(fd, locker, MAXNAME)) < 1) {
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
strcpy( locker, getlogin()) ;
|
||||
/*
|
||||
** Since Ubuntu 17.04, cuserid prototype seems missing. Replacing it by
|
||||
** getlogin does the trick on 64 bits but fails on 32 bits.
|
||||
** So let's work around with cuserid for a while.
|
||||
** logname = getlogin() ;
|
||||
** strcpy( locker, logname ? logname : cuserid( NULL)) ;
|
||||
*/
|
||||
strcpy( locker, cuserid( NULL)) ;
|
||||
|
||||
strcat(locker + strlen(locker), "@");
|
||||
gethostname(locker + strlen(locker), 64);
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user