lib/replace: We cannot use strchr_m in lib/replace
authorAndrew Bartlett <abartlet@samba.org>
Fri, 1 Jun 2012 04:07:42 +0000 (14:07 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 2 Jun 2012 00:13:49 +0000 (02:13 +0200)
In any case, it is always safe to search for . even in a multibyte string.

Andrew Bartlett

lib/replace/xattr.c

index e3e0768d9c8572545322ee5b36dafccca2d0f56e..192784f344daf38d7e4021d89ae1339b8fa69abd 100644 (file)
@@ -55,7 +55,7 @@ ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t si
        ssize_t retval;
        int attrnamespace = (strncmp(name, "system", 6) == 0) ? 
                EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
-       const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
+       const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1;
        /*
         * The BSD implementation has a nasty habit of silently truncating
         * the returned value to the size of the buffer, so we have to check
@@ -111,7 +111,7 @@ ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size)
        ssize_t retval;
        int attrnamespace = (strncmp(name, "system", 6) == 0) ? 
                EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
-       const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
+       const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1;
 
        if((retval=extattr_get_fd(filedes, attrnamespace, attrname, NULL, 0)) >= 0) {
                if(retval > size) {
@@ -385,7 +385,7 @@ int rep_removexattr (const char *path, const char *name)
        char *s;
        int attrnamespace = (strncmp(name, "system", 6) == 0) ? 
                EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
-       const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
+       const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1;
 
        return extattr_delete_file(path, attrnamespace, attrname);
 #elif defined(HAVE_ATTR_REMOVE)
@@ -424,7 +424,7 @@ int rep_fremovexattr (int filedes, const char *name)
        char *s;
        int attrnamespace = (strncmp(name, "system", 6) == 0) ? 
                EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
-       const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
+       const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1;
 
        return extattr_delete_fd(filedes, attrnamespace, attrname);
 #elif defined(HAVE_ATTR_REMOVEF)
@@ -464,7 +464,7 @@ int rep_setxattr (const char *path, const char *name, const void *value, size_t
        int retval = 0;
        int attrnamespace = (strncmp(name, "system", 6) == 0) ? 
                EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
-       const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
+       const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1;
        if (flags) {
                /* Check attribute existence */
                retval = extattr_get_file(path, attrnamespace, attrname, NULL, 0);
@@ -529,7 +529,7 @@ int rep_fsetxattr (int filedes, const char *name, const void *value, size_t size
        int retval = 0;
        int attrnamespace = (strncmp(name, "system", 6) == 0) ? 
                EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
-       const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
+       const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1;
        if (flags) {
                /* Check attribute existence */
                retval = extattr_get_fd(filedes, attrnamespace, attrname, NULL, 0);