Do not assume a _file member in FILE structures as it may not exist on some

systems (e.g., Linux).  Instead, use fileno(3).  Closes PR pkg/29498.
This commit is contained in:
jmmv 2005-06-14 18:32:48 +00:00
parent 325c3e4463
commit fad1e9ffcb
2 changed files with 38 additions and 7 deletions

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.3 2005/02/23 23:12:05 agc Exp $
$NetBSD: distinfo,v 1.4 2005/06/14 18:32:48 jmmv Exp $
SHA1 (xpipeman-1.5.tar.gz) = 065ec572f7be019737e2bb9ed131bc907c713cc5
RMD160 (xpipeman-1.5.tar.gz) = 9668409dadf70bf5bf4a546a3340846191937c74
@ -8,4 +8,4 @@ SHA1 (patch-ab) = 43bea8141e49a300402d435d4858ec61284efa52
SHA1 (patch-ac) = d0c388585988208e47b69dcaa1131870f74676a1
SHA1 (patch-ad) = a97f685ab79b18d7717ccaf8771b34f645492434
SHA1 (patch-ae) = 850a1d6d46df30303021d09b62879e0d7b3d960b
SHA1 (patch-af) = ccae962e4a2f4ea4351660174b56ec276fe1ed30
SHA1 (patch-af) = 7b1f5bcbe9518668bd1ca84fd7e58309dedfb232

View file

@ -1,16 +1,47 @@
$NetBSD: patch-af,v 1.2 1998/11/12 23:34:32 frueauf Exp $
$NetBSD: patch-af,v 1.3 2005/06/14 18:32:48 jmmv Exp $
--- score.c.orig Sun Aug 9 03:56:41 1998
+++ score.c Sun Aug 9 03:57:23 1998
@@ -72,3 +72,3 @@
--- score.c.orig 1991-09-13 22:32:12.000000000 +0200
+++ score.c
@@ -70,7 +70,7 @@ void show_scores(),
write_out_scores();
static FILE *scorefile = 0;
-char *score_filename;
+extern AppData app_data;
@@ -102,4 +102,4 @@
/*----------------------------------------------------------------------*/
@@ -87,7 +87,7 @@ check_score(current_score,level)
}
if(scorefile) {
#ifndef SYSV
- flock(scorefile->_file, LOCK_UN);
+ flock(fileno(scorefile), LOCK_UN);
#endif
fclose(scorefile);
show_scores();
@@ -100,12 +100,12 @@ load_scores()
{
int i = 0;
- if( !(scorefile = fopen(score_filename,"r+")) ) {
- scorefile = fopen(score_filename, "w");
+ if( !(scorefile = fopen(app_data.score_filename,"r+")) ) {
+ scorefile = fopen(app_data.score_filename, "w");
return;
}
#ifndef SYSV
- flock(scorefile->_file, LOCK_EX);
+ flock(fileno(scorefile), LOCK_EX);
#endif
while( fgets(scores[i].score,6,scorefile) /* get score */
&& fgets(scores[i].name,26,scorefile) /* get name */
@@ -281,7 +281,7 @@ show_scores_callback()
if(scorefile) {
#ifndef SYSV
- flock(scorefile->_file, LOCK_UN);
+ flock(fileno(scorefile), LOCK_UN);
#endif
fclose(scorefile);
show_scores();