]> arthur.barton.de Git - netatalk.git/commitdiff
Deal with pathologic idiosyncrasies, every OS return a different errno for o_nofollow...
authorfranklahm <franklahm>
Tue, 13 Apr 2010 08:05:06 +0000 (08:05 +0000)
committerfranklahm <franklahm>
Tue, 13 Apr 2010 08:05:06 +0000 (08:05 +0000)
configure.in
libatalk/adouble/ad_open.c
libatalk/vfs/ea_sys.c

index 99d3f0272d93e30d9d995a7f591d1906d8c692b8..b90d14cea1284bb08224360b5937d4224c4417e4 100644 (file)
@@ -1,4 +1,4 @@
-dnl $Id: configure.in,v 1.243 2010-04-12 14:28:42 franklahm Exp $
+dnl $Id: configure.in,v 1.244 2010-04-13 08:05:06 franklahm Exp $
 dnl configure.in for netatalk
 
 AC_INIT(etc/afpd/main.c)
@@ -597,6 +597,8 @@ dnl       /usr/include or similar places.
 LIBS="$LIBS -L\$(top_srcdir)/libatalk"
 CFLAGS="-I\$(top_srcdir)/include $CFLAGS -I\$(top_srcdir)/sys"
 
+AC_DEFINE(OPEN_NOFOLLOW_ERRNO, ELOOP, errno returned by open with O_NOFOLLOW)
+
 dnl --------------------------------------------------------------------------
 dnl specific configuration comes in here:
 dnl --------------------------------------------------------------------------
@@ -650,6 +652,7 @@ if test x"$this_os" = "xfreebsd"; then
        AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
        AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
        AC_DEFINE(SENDFILE_FLAVOR_BSD, 1, [Define if the sendfile() function uses BSD semantics])
+    AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
 fi
 
 dnl ----- HP-UX 11 specific -----
@@ -796,6 +799,8 @@ if test x"$this_os" = "xnetbsd"; then
        AC_MSG_RESULT([ * NetBSD specific configuration])
        AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
        AC_DEFINE(NETBSD, 1, [Define if OS is NetBSD])
+    AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EFTYPE, errno returned by open with O_NOFOLLOW)
+
        CFLAGS="-I\$(top_srcdir)/sys/netbsd $CFLAGS"
        need_dash_r=yes 
 
index bc3bc3b0a039d6b70709bd6e2541b6475da9631f..88036d6e6caf530158703705bf1a129bba17deb5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ad_open.c,v 1.73 2010-03-30 12:55:26 franklahm Exp $
+ * $Id: ad_open.c,v 1.74 2010-04-13 08:05:06 franklahm Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu)
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -1292,7 +1292,7 @@ int ad_open( const char *path, int adflags, int oflags, int mode, struct adouble
                     hoflags = oflags;
                     ad->ad_data_fork.adf_fd = open( path, hoflags | O_NOFOLLOW, admode );
                 }
-                if (ad->ad_data_fork.adf_fd == -1 && errno == ELOOP) {
+                if (ad->ad_data_fork.adf_fd == -1 && errno == OPEN_NOFOLLOW_ERRNO) {
                     int lsz;
 
                     ad->ad_data_fork.adf_syml = malloc(PATH_MAX+1);
index 38e61cd41ee1a197532cdb6b01452130bc9f1b52..f9b305aa89764360454e95b6d9479bf2a2b85d98 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  $Id: ea_sys.c,v 1.7 2010-04-03 07:11:36 franklahm Exp $
+  $Id: ea_sys.c,v 1.8 2010-04-13 08:05:06 franklahm Exp $
   Copyright (c) 2009 Frank Lahm <franklahm@gmail.com>
 
   This program is free software; you can redistribute it and/or modify
@@ -98,7 +98,7 @@ int sys_get_easize(VFS_FUNC_ARGS_EA_GETSIZE)
         memset(rbuf, 0, 4);
         *rbuflen += 4;
         switch(errno) {
-        case ELOOP:
+        case OPEN_NOFOLLOW_ERRNO:
             /* its a symlink and client requested O_NOFOLLOW  */
             LOG(log_debug, logtype_afpd, "sys_getextattr_size(%s): encountered symlink with kXAttrNoFollow", uname);
             return AFP_OK;
@@ -173,7 +173,7 @@ int sys_get_eacontent(VFS_FUNC_ARGS_EA_GETCONTENT)
         memset(rbuf, 0, 4);
         *rbuflen += 4;
         switch(errno) {
-        case ELOOP:
+        case OPEN_NOFOLLOW_ERRNO:
             /* its a symlink and client requested O_NOFOLLOW  */
             LOG(log_debug, logtype_afpd, "sys_getextattr_content(%s): encountered symlink with kXAttrNoFollow", uname);
             return AFP_OK;
@@ -235,7 +235,7 @@ int sys_list_eas(VFS_FUNC_ARGS_EA_LIST)
     }
 
     if (ret == -1) switch(errno) {
-        case ELOOP:
+        case OPEN_NOFOLLOW_ERRNO:
             /* its a symlink and client requested O_NOFOLLOW */
             ret = AFPERR_BADTYPE;
         default:
@@ -316,7 +316,7 @@ int sys_set_ea(VFS_FUNC_ARGS_EA_SET)
 
     if (ret == -1) {
         switch(errno) {
-        case ELOOP:
+        case OPEN_NOFOLLOW_ERRNO:
             /* its a symlink and client requested O_NOFOLLOW  */
             LOG(log_debug, logtype_afpd, "sys_set_ea(%s/%s): encountered symlink with kXAttrNoFollow",
                 uname, attruname);
@@ -365,7 +365,7 @@ int sys_remove_ea(VFS_FUNC_ARGS_EA_REMOVE)
 
     if (ret == -1) {
         switch(errno) {
-        case ELOOP:
+        case OPEN_NOFOLLOW_ERRNO:
             /* its a symlink and client requested O_NOFOLLOW  */
             LOG(log_debug, logtype_afpd, "sys_remove_ea(%s/%s): encountered symlink with kXAttrNoFollow", uname);
             return AFP_OK;