Mon Dec 4 15:38:12 CET 2006 - mt@suse.de
- Improved realpath() wrapper in media handler class (#222521).
-- revision 4737
+- revision 4758
-------------------------------------------------------------------
Thu Nov 30 09:15:20 CET 2006 - ma@suse.de
#include "zypp/media/Mount.h"
#include <limits.h>
#include <stdlib.h>
+#include <errno.h>
+
using namespace std;
if( !path.empty())
{
#if __GNUC__ > 2
+ /** GNU extension */
char *ptr = ::realpath(path.c_str(), NULL);
if( ptr != NULL)
{
real = ptr;
free( ptr);
}
+ else
+ /** the SUSv2 way */
+ if( EINVAL == errno)
+ {
+ char buff[PATH_MAX + 2];
+ memset(buff, '\0', sizeof(buff));
+ if( ::realpath(path.c_str(), buff) != NULL)
+ {
+ real = buff;
+ }
+ }
#else
char buff[PATH_MAX + 2];
memset(buff, '\0', sizeof(buff));