mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
misc: Use C99 initializer to initialize string
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
@@ -217,7 +217,7 @@ char *ssh_get_user_home_dir(void) {
|
|||||||
char *szPath = NULL;
|
char *szPath = NULL;
|
||||||
struct passwd pwd;
|
struct passwd pwd;
|
||||||
struct passwd *pwdbuf;
|
struct passwd *pwdbuf;
|
||||||
char buf[NSS_BUFLEN_PASSWD];
|
char buf[NSS_BUFLEN_PASSWD] = {0};
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = getpwuid_r(getuid(), &pwd, buf, NSS_BUFLEN_PASSWD, &pwdbuf);
|
rc = getpwuid_r(getuid(), &pwd, buf, NSS_BUFLEN_PASSWD, &pwdbuf);
|
||||||
@@ -226,7 +226,6 @@ char *ssh_get_user_home_dir(void) {
|
|||||||
if (szPath == NULL) {
|
if (szPath == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(buf, 0, sizeof(buf));
|
|
||||||
snprintf(buf, sizeof(buf), "%s", szPath);
|
snprintf(buf, sizeof(buf), "%s", szPath);
|
||||||
|
|
||||||
return strdup(buf);
|
return strdup(buf);
|
||||||
|
|||||||
Reference in New Issue
Block a user