Browse Source

[components/libc/posix]fix the errors that assigning an integer to a pointer and always return EINVAL.

ligr 7 months ago
parent
commit
0bac8c4f90
1 changed files with 4 additions and 1 deletions
  1. 4 1
      components/libc/posix/pthreads/pthread_barrier.c

+ 4 - 1
components/libc/posix/pthreads/pthread_barrier.c

@@ -45,7 +45,10 @@ int pthread_barrierattr_setpshared(pthread_barrierattr_t *attr, int pshared)
     if (!attr)
     if (!attr)
         return EINVAL;
         return EINVAL;
     if (pshared == PTHREAD_PROCESS_PRIVATE)
     if (pshared == PTHREAD_PROCESS_PRIVATE)
-        attr = PTHREAD_PROCESS_PRIVATE;
+    {
+        *attr = PTHREAD_PROCESS_PRIVATE;
+        return 0;
+    }
 
 
     return EINVAL;
     return EINVAL;
 }
 }