www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/09/04/10:43:36

Date: Fri, 4 Sep 92 16:12:41 +0100
From: buers AT dg1 DOT chemie DOT uni-konstanz DOT de (Dieter Buerssner)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Cc: dj AT ctron DOT com
Subject: bug in setvbuf and fix

The following program fails with segmentation violation with djgpp 1.08
on my machine.

(This is just a stupid test case)
#include <stdio.h>
main()
{
  setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
  printf("Hello\n");
  return(0);
}

after the following patch of libsrc/c/io/setvbuf.c the program works
as expected. I hope the patch doesn't break anything else.

Dieter


-------------- Cut here ------------
*** setvbufc.org	Fri Sep  4 19:58:16 1992
--- setvbuf.c	Fri Sep  4 19:58:36 1992
***************
*** 38,44 ****
        f->_flag |= type;
        if (mine)
          f->_flag |= _IOMYBUF;
!       f->_base = buf;
        f->_bufsiz = len;
        return 0;
      case _IONBF:
--- 38,44 ----
        f->_flag |= type;
        if (mine)
          f->_flag |= _IOMYBUF;
!       f->_ptr = f->_base = buf;
        f->_bufsiz = len;
        return 0;
      case _IONBF:

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019