Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/libbb/wfopen.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 983 by niro, Fri Apr 24 18:33:46 2009 UTC revision 984 by niro, Sun May 30 11:32:42 2010 UTC
# Line 14  FILE* FAST_FUNC fopen_or_warn(const char Line 14  FILE* FAST_FUNC fopen_or_warn(const char
14   FILE *fp = fopen(path, mode);   FILE *fp = fopen(path, mode);
15   if (!fp) {   if (!fp) {
16   bb_simple_perror_msg(path);   bb_simple_perror_msg(path);
17   errno = 0;   //errno = 0; /* why? */
18   }   }
19   return fp;   return fp;
20  }  }
# Line 38  FILE* FAST_FUNC xfopen_for_write(const c Line 38  FILE* FAST_FUNC xfopen_for_write(const c
38  {  {
39   return xfopen(path, "w");   return xfopen(path, "w");
40  }  }
41    
42    static FILE* xfdopen_helper(unsigned fd_and_rw_bit)
43    {
44     FILE* fp = fdopen(fd_and_rw_bit >> 1, fd_and_rw_bit & 1 ? "w" : "r");
45     if (!fp)
46     bb_error_msg_and_die(bb_msg_memory_exhausted);
47     return fp;
48    }
49    FILE* FAST_FUNC xfdopen_for_read(int fd)
50    {
51     return xfdopen_helper(fd << 1);
52    }
53    FILE* FAST_FUNC xfdopen_for_write(int fd)
54    {
55     return xfdopen_helper((fd << 1) + 1);
56    }

Legend:
Removed from v.983  
changed lines
  Added in v.984