This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: fdisk crashes (Was: glibc 2.1.93)
- To: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Subject: Re: fdisk crashes (Was: glibc 2.1.93)
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Tue, 5 Sep 2000 14:42:44 -0700
- Cc: drepper at cygnus dot com, libc-alpha at sourceware dot cygnus dot com
- References: <m366ogq5qq.fsf@otr.mynet.cygnus.com> <200009051926.VAA03008@loewis.home.cs.tu-berlin.de>
On Tue, Sep 05, 2000 at 09:26:53PM +0200, Martin v. Loewis wrote:
> On my RedHat 5.2 installation, after upgrading numerous utilities and
> recently installing glibc 2.1.93, I now find that fdisk crashes:
>
> [root@mira martin]# /sbin/fdisk
> Using /dev/sda as default device!
> The number of cylinders for this disk is set to 1109.
> This is larger than 1024, and may cause problems with:
> 1) software that runs at boot time (e.g., LILO)
> 2) booting and partitioning software from other OSs
> (e.g., DOS FDISK, OS/2 FDISK)
>
> Segmentation fault
>
Ulrich, we have to check glibc 2.0. This patch seems to work for me.
H.J.
---
2000-09-05 H.J. Lu <hjl@gnu.org>
* libio/libio.h (_IO_fwide): Check for libio in glibc 2.0.
Index: libio/libio.h
===================================================================
RCS file: /work/cvs/gnu/glibc/libio/libio.h,v
retrieving revision 1.1.1.5
diff -u -p -r1.1.1.5 libio.h
--- libio/libio.h 2000/09/03 18:03:38 1.1.1.5
+++ libio/libio.h 2000/09/05 21:29:13
@@ -475,16 +475,22 @@ extern int _IO_fwide (_IO_FILE *__fp, in
/* A special optimized version of the function above. It optimizes the
case of initializing an unoriented byte stream. */
# define _IO_fwide(__fp, __mode) \
- ({ int __result = (__mode); \
- if (__result < 0) \
+ ({ int __result; \
+ if ((__fp) != _IO_stdin && (__fp) != _IO_stdout && (__fp) != _IO_stderr) \
{ \
- if ((__fp)->_mode == 0) \
- /* We know that all we have to do is to set the flag. */ \
- (__fp)->_mode = -1; \
- __result = (__fp)->_mode; \
+ __result = (__mode); \
+ if (__result < 0) \
+ { \
+ if ((__fp)->_mode == 0) \
+ /* We know that all we have to do is to set the flag. */ \
+ (__fp)->_mode = -1; \
+ __result = (__fp)->_mode; \
+ } \
+ else \
+ __result = _IO_fwide (__fp, __result); \
} \
else \
- __result = _IO_fwide (__fp, __result); \
+ __result = -1; \
__result; })
# endif