8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/port/fseeko.c,v 1.2 2002/10/23 21:16:17 momjian Exp $
11
+ * $Header: /cvsroot/pgsql/src/port/fseeko.c,v 1.3 2002/10/23 21:39:27 momjian Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -40,16 +40,10 @@ fseeko(FILE *stream, off_t offset, int whence)
40
40
case SEEK_CUR :
41
41
flockfile (stream );
42
42
if (fgetpos (stream ,& floc )!= 0 )
43
- {
44
- funlockfile (stream );
45
- return -1 ;
46
- }
43
+ gotofailure ;
47
44
floc += offset ;
48
45
if (fsetpos (stream ,& floc )!= 0 )
49
- {
50
- funlockfile (stream );
51
- return -1 ;
52
- }
46
+ gotofailure ;
53
47
flockfile (stream );
54
48
return 0 ;
55
49
break ;
@@ -61,23 +55,21 @@ fseeko(FILE *stream, off_t offset, int whence)
61
55
case SEEK_END :
62
56
flockfile (stream );
63
57
if (fstat (fileno (stream ),& filestat )!= 0 )
64
- {
65
- funlockfile (stream );
66
- return -1 ;
67
- }
58
+ gotofailure ;
68
59
floc = filestat .st_size ;
69
60
if (fsetpos (stream ,& floc )!= 0 )
70
- {
71
- funlockfile (stream );
72
- return -1 ;
73
- }
61
+ gotofailure ;
74
62
funlockfile (stream );
75
63
return 0 ;
76
64
break ;
77
65
default :
78
66
errno = EINVAL ;
79
67
return -1 ;
80
68
}
69
+
70
+ failure :
71
+ funlockfile (stream );
72
+ return -1 ;
81
73
}
82
74
83
75