浏览代码

ret could have been used uninitialized in one case

Eric Andersen 22 年之前
父节点
当前提交
a42a105966
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      libc/pwd_grp/pwent.c
  2. 1 1
      libc/pwd_grp/spent.c

+ 1 - 1
libc/pwd_grp/pwent.c

@@ -67,7 +67,7 @@ void endpwent(void)
 int getpwent_r (struct passwd *password, char *buff, 
 	size_t buflen, struct passwd **result)
 {
-    int ret;
+    int ret=EINVAL;
     LOCK;
     *result = NULL;
     if (pw_fd != -1 && (ret=__getpwent_r(password, buff, buflen, pw_fd)) == 0) {

+ 1 - 1
libc/pwd_grp/spent.c

@@ -64,7 +64,7 @@ void endspent(void)
 int getspent_r (struct spwd *spwd, char *buff, 
 	size_t buflen, struct spwd **result)
 {
-    int ret;
+    int ret=EINVAL;
     LOCK;
     *result = NULL;
     if (spwd_fd != -1 && (ret=__getspent_r(spwd, buff, buflen, spwd_fd)) == 0) {