Page MenuHomeFreeBSD

D43327.diff
No OneTemporary

D43327.diff

diff --git a/lib/libthr/thread/thr_attr.c b/lib/libthr/thread/thr_attr.c
--- a/lib/libthr/thread/thr_attr.c
+++ b/lib/libthr/thread/thr_attr.c
@@ -117,8 +117,7 @@
if (attr == NULL || *attr == NULL)
return (EINVAL);
- if ((*attr)->cpuset != NULL)
- free((*attr)->cpuset);
+ free((*attr)->cpuset);
free(*attr);
*attr = NULL;
return (0);
@@ -151,7 +150,7 @@
return (error);
attr = pthread->attr;
- if (pthread->flags & THR_FLAGS_DETACHED)
+ if ((pthread->flags & THR_FLAGS_DETACHED) != 0)
attr.flags |= PTHREAD_DETACHED;
error = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, TID(pthread),
@@ -180,7 +179,7 @@
if (attr == NULL || *attr == NULL || detachstate == NULL)
return (EINVAL);
- if ((*attr)->flags & PTHREAD_DETACHED)
+ if (((*attr)->flags & PTHREAD_DETACHED) != 0)
*detachstate = PTHREAD_CREATE_DETACHED;
else
*detachstate = PTHREAD_CREATE_JOINABLE;
@@ -258,7 +257,7 @@
if (attr == NULL || *attr == NULL || contentionscope == NULL)
return (EINVAL);
- *contentionscope = (*attr)->flags & PTHREAD_SCOPE_SYSTEM ?
+ *contentionscope = ((*attr)->flags & PTHREAD_SCOPE_SYSTEM) != 0 ?
PTHREAD_SCOPE_SYSTEM : PTHREAD_SCOPE_PROCESS;
return (0);
}
@@ -321,7 +320,7 @@
if ((pattr = malloc(sizeof(*pattr))) == NULL)
return (ENOMEM);
- memcpy(pattr, &_pthread_attr_default, sizeof(struct pthread_attr));
+ memcpy(pattr, &_pthread_attr_default, sizeof(*pattr));
*attr = pattr;
return (0);
}
@@ -449,7 +448,7 @@
return (EINVAL);
if (contentionscope == PTHREAD_SCOPE_SYSTEM)
- (*attr)->flags |= contentionscope;
+ (*attr)->flags |= PTHREAD_SCOPE_SYSTEM;
else
(*attr)->flags &= ~PTHREAD_SCOPE_SYSTEM;
return (0);
@@ -546,6 +545,7 @@
if (cpusetsize > kern_size) {
/* Kernel checks invalid bits, we check it here too. */
size_t i;
+
for (i = kern_size; i < cpusetsize; ++i)
if (((const char *)cpusetp)[i] != 0)
return (EINVAL);

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 29, 5:39 AM (8 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15628033
Default Alt Text
D43327.diff (1 KB)

Event Timeline