1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-21 00:26:27 -05:00

revert to cuserid for systems where getlogin fails

This commit is contained in:
Renaud 2017-05-07 10:50:09 +08:00
parent 9d864d8b00
commit 18cd0ba37f

View File

@ -33,6 +33,7 @@ int gethostname(char *name, int namelen)
} }
#endif #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) { if ((n = read(fd, locker, MAXNAME)) < 1) {
lseek(fd, 0, SEEK_SET); 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), "@"); strcat(locker + strlen(locker), "@");
gethostname(locker + strlen(locker), 64); gethostname(locker + strlen(locker), 64);
{ {