libc/pwd: Correct the geos related comment and ddd ROOT_GEOS macro

fix the minor issue in https://github.com/apache/nuttx/pull/7998

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-06-25 19:47:32 +08:00 committed by Alan Carvalho de Assis
parent f1f33917f7
commit b64c029080
6 changed files with 11 additions and 5 deletions

View File

@ -133,13 +133,14 @@ static int pwd_foreach(pwd_foreach_match_t match, uintptr_t arg,
*
* The format of the password file is:
*
* user:x:uid:uid:home
* user:x:uid:uid:geos:home
*
* Where:
* user: User name
* x: Encrypted password
* uid: User ID
* uid: Group ID
* geos: User information
* home: Login directory
*/

View File

@ -71,7 +71,7 @@ FAR struct passwd *getpwnam(FAR const char *name)
return NULL;
}
return getpwbuf(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_NAME, ROOT_DIR,
return getpwbuf(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_GEOCS, ROOT_DIR,
ROOT_SHELL);
#endif
}

View File

@ -82,7 +82,7 @@ int getpwnam_r(FAR const char *name, FAR struct passwd *pwd, FAR char *buf,
return 0;
}
return getpwbuf_r(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_NAME, ROOT_DIR,
return getpwbuf_r(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_GEOCS, ROOT_DIR,
ROOT_SHELL, pwd, buf, buflen, result);
#endif
}

View File

@ -70,7 +70,7 @@ FAR struct passwd *getpwuid(uid_t uid)
return NULL;
}
return getpwbuf(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_NAME, ROOT_DIR,
return getpwbuf(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_GEOCS, ROOT_DIR,
ROOT_SHELL);
#endif
}

View File

@ -81,7 +81,7 @@ int getpwuid_r(uid_t uid, FAR struct passwd *pwd, FAR char *buf,
return 0;
}
return getpwbuf_r(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_NAME, ROOT_DIR,
return getpwbuf_r(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_GEOCS, ROOT_DIR,
ROOT_SHELL, pwd, buf, buflen, result);
#endif
}

View File

@ -33,9 +33,14 @@
* Pre-processor Definitions
****************************************************************************/
#ifndef CONFIG_LIBC_PASSWD_LINESIZE
# define CONFIG_LIBC_PASSWD_LINESIZE 80
#endif
#define ROOT_NAME "root"
#define ROOT_UID 0
#define ROOT_GID 0
#define ROOT_GEOCS "root"
#define ROOT_DIR "/root"
#define ROOT_SHELL "/bin/nsh"