Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/libbb/xreadlink.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 1  Line 1 
1  /* vi: set sw=4 ts=4: */  /* vi: set sw=4 ts=4: */
2  /*  /*
3   *  xreadlink.c - safe implementation of readlink.   * xreadlink.c - safe implementation of readlink.
4   *  Returns a NULL on failure...   * Returns a NULL on failure...
5     *
6     * Licensed under GPLv2, see file LICENSE in this tarball for details.
7   */   */
8    
9  #include "libbb.h"  #include "libbb.h"
# Line 89  char* FAST_FUNC xmalloc_readlink_or_warn Line 91  char* FAST_FUNC xmalloc_readlink_or_warn
91   char *buf = xmalloc_readlink(path);   char *buf = xmalloc_readlink(path);
92   if (!buf) {   if (!buf) {
93   /* EINVAL => "file: Invalid argument" => puzzled user */   /* EINVAL => "file: Invalid argument" => puzzled user */
94   bb_error_msg("%s: cannot read link (not a symlink?)", path);   const char *errmsg = "not a symlink";
95     int err = errno;
96     if (err != EINVAL)
97     errmsg = strerror(err);
98     bb_error_msg("%s: cannot read link: %s", path, errmsg);
99   }   }
100   return buf;   return buf;
101  }  }

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