From: Ulrich Drepper Date: Wed, 24 Jun 1998 17:25:57 +0000 (+0000) Subject: (_nss_files_get,ENTNAME_r): Initialize position when file was opened here. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=180093a842d97e4de5f6cdaf8e21bf66598e8f84;p=thirdparty%2Fglibc.git (_nss_files_get,ENTNAME_r): Initialize position when file was opened here. --- diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c index b36a8b97157..c1e716d3d00 100644 --- a/nss/nss_files/files-XXX.c +++ b/nss/nss_files/files-XXX.c @@ -223,7 +223,16 @@ CONCAT(_nss_files_get,ENTNAME_r) (struct STRUCTURE *result, /* Be prepared that the set*ent function was not called before. */ if (stream == NULL) - status = internal_setent (0); + { + status = internal_setent (0); + + if (status == NSS_STATUS_SUCCESS && fgetpos (stream, &position) < 0) + { + fclose (stream); + stream = NULL; + status = NSS_STATUS_UNAVAIL; + } + } if (status == NSS_STATUS_SUCCESS) {