This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] sched_setaffinity return/errno value


Hi,

sched_setaffinity returns EINVAL in one place instead of setting
errno to EINVAL and to return -1. Here is a fix for it:

2004-06-17  Thorsten Kukuk  <kukuk@suse.de>

	* sysdeps/unix/sysv/linux/sched_setaffinity.c (__sched_setaffinity_new):
	Set errno to EINVAL and return -1 if cpuset is wrongly set.

--- sysdeps/unix/sysv/linux/sched_setaffinity.c
+++ sysdeps/unix/sysv/linux/sched_setaffinity.c	2004/06/17 10:03:42
@@ -60,10 +60,13 @@
      does not request to set a bit beyond that.  */
   for (size_t cnt = __kernel_cpumask_size; cnt < cpusetsize; ++cnt)
     if (((char *) cpuset)[cnt] != '\0')
-      /* Found a nonzero byte.  This means the user request cannot be
-	 fulfilled.  */
-      return EINVAL;
-
+      {
+        /* Found a nonzero byte.  This means the user request cannot be
+	   fulfilled.  */
+	__set_errno (EINVAL);
+	return -1;
+      }
+
   return INLINE_SYSCALL (sched_setaffinity, 3, pid, cpusetsize, cpuset);
 }
 versioned_symbol (libc, __sched_setaffinity_new, sched_setaffinity,

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE Linux AG        Maxfeldstr. 5                 D-90409 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]