diff --git a/libc/grp/getgrent.cpp b/libc/grp/getgrent.cpp index 0f96b124..a7b57a38 100644 --- a/libc/grp/getgrent.cpp +++ b/libc/grp/getgrent.cpp @@ -25,8 +25,6 @@ #include #include -extern "C" { FILE* __grp_file = NULL; } - extern "C" struct group* getgrent(void) { if ( !__grp_file && !(__grp_file = opengr()) ) diff --git a/libc/grp/setgrent.cpp b/libc/grp/setgrent.cpp index c8476f87..ce3034b2 100644 --- a/libc/grp/setgrent.cpp +++ b/libc/grp/setgrent.cpp @@ -1,6 +1,6 @@ /******************************************************************************* - Copyright(C) Jonas 'Sortie' Termansen 2013. + Copyright(C) Jonas 'Sortie' Termansen 2013, 2015. This file is part of the Sortix C Library. @@ -25,10 +25,12 @@ #include #include +extern "C" { FILE* __grp_file = NULL; } + extern "C" void setgrent(void) { if ( __grp_file ) - fseeko(__grp_file, 0, SEEK_SET); + rewind(__grp_file); else __grp_file = opengr(); } diff --git a/libc/pwd/getpwent.cpp b/libc/pwd/getpwent.cpp index a07630ee..adbe1b33 100644 --- a/libc/pwd/getpwent.cpp +++ b/libc/pwd/getpwent.cpp @@ -25,8 +25,6 @@ #include #include -extern "C" { FILE* __pwd_file = NULL; } - extern "C" struct passwd* getpwent(void) { if ( !__pwd_file && !(__pwd_file = openpw()) ) diff --git a/libc/pwd/setpwent.cpp b/libc/pwd/setpwent.cpp index c52266f3..a682a67d 100644 --- a/libc/pwd/setpwent.cpp +++ b/libc/pwd/setpwent.cpp @@ -1,6 +1,6 @@ /******************************************************************************* - Copyright(C) Jonas 'Sortie' Termansen 2013. + Copyright(C) Jonas 'Sortie' Termansen 2013, 2015. This file is part of the Sortix C Library. @@ -25,10 +25,12 @@ #include #include +extern "C" { FILE* __pwd_file = NULL; } + extern "C" void setpwent(void) { if ( __pwd_file ) - fseeko(__pwd_file, 0, SEEK_SET); + rewind(__pwd_file); else __pwd_file = openpw(); }