Why is getpwnam() always returning root information in a function?

余生颓废 提交于 2019-12-08 18:18:26

The return value may point to a static area which is overwritten by a subsequent call to getpwent(), getpwnam(), or getpwuid().

http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpwnam.html

In particular, there is no guarantee about the ordering of reads/writes, so it is not safe to pass data returned from getpwnam back to getpwnam.

You really should not use getpwnam at all; use getpwnam_r instead.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!