BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001453 [uClibc] Stdio minor always 08-06-07 11:53 09-24-08 07:10
Reporter chmeee View Status public  
Assigned To uClibc
Priority normal Resolution unable to reproduce  
Status closed   Product Version
Summary 0001453: setlinebuf() doesn't work
Description setlinebuf() ends up setting unbuffered mode. The attached patch fixes this.
Additional Information
Attached Files  setvbuf.diff [^] (603 bytes) 08-06-07 11:53

- Relationships

- Notes
(0011874)
bernhardf
09-24-08 07:10

Works for me on current trunk:

$ cat setlinebuf.c
#include <stdio.h>
#include <errno.h>
#ifdef __UCLIBC__
#define foo __modeflags
#else
#define foo _IO_file_flags
#define __FLAG_LBF _IO_LINE_BUF
#define __FLAG_NBF _IO_UNBUFFERED
#endif
#define bar(x) ((fla & x) == x)
static void print_flags(int fla) {
  printf("%d & __FLAG_LBF = %d\n", fla, bar(__FLAG_LBF));
  printf("%d & __FLAG_NBF = %d\n", fla, bar(__FLAG_NBF));
}
int main(void) {
  int err;
  FILE *fp = fopen("/tmp/filp","w");
  if (!fp)
    return 1;
  print_flags(fp->foo);
  setlinebuf (fp);
  err = errno;
  print_flags(fp->foo);
  printf("errno=%d\n", err);
  return 0;
}

$ gcc -o setlinebuf setlinebuf.c && ./setlinebuf
-72539004 & __FLAG_LBF = 0
-72539004 & __FLAG_NBF = 0
-72538492 & __FLAG_LBF = 1
-72538492 & __FLAG_NBF = 0
errno=0
$ /scratch/src/buildroot.git.pentium4/build_i386/staging_dir/usr/bin/i386-linux-uclibc-gcc -Os -o setlinebuf_ setlinebuf.c -static && ./setlinebuf_
24592 & __FLAG_LBF = 0
24592 & __FLAG_NBF = 0
8464 & __FLAG_LBF = 1
8464 & __FLAG_NBF = 0
errno=0
 

- Issue History
Date Modified Username Field Change
08-06-07 11:53 chmeee New Issue
08-06-07 11:53 chmeee Status new => assigned
08-06-07 11:53 chmeee Assigned To  => uClibc
08-06-07 11:53 chmeee File Added: setvbuf.diff
09-24-08 07:10 bernhardf Status assigned => closed
09-24-08 07:10 bernhardf Note Added: 0011874
09-24-08 07:10 bernhardf Resolution open => unable to reproduce


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker