diff options
author | Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> | 2009-04-13 09:47:36 +0900 |
---|---|---|
committer | Dhaval Giani <dhaval@linux.vnet.ibm.com> | 2009-04-13 16:52:54 +0530 |
commit | 973dac482d4a46386ad14602df2cf37470258238 (patch) | |
tree | f398d496c134e45ac1d9a65f79516858667050bb /install-sh | |
parent | e9b0b26d8bf46719b05e8ebf7bccb829ba1cec93 (diff) | |
download | libcg-973dac482d4a46386ad14602df2cf37470258238.tar.gz libcg-973dac482d4a46386ad14602df2cf37470258238.tar.xz libcg-973dac482d4a46386ad14602df2cf37470258238.zip |
Fix the lacks of pthread_rwlock_unlock() calls.
Two pthread_rwlock_unlock() calls are necessary if *cgroup is null
and fprintf()/fflush() fails in cgroup_attach_task_pid():
src/api.c:785
785 pthread_rwlock_rdlock(&cg_mount_table_lock);
786 for(i = 0; i < CG_CONTROLLER_MAX &&
787 cg_mount_table[i].name[0]!='\0'; i++) {
[snip]
805 ret = fprintf(tasks, "%d", tid);
806 if (ret < 0) {
<<pthread_rwlock_unlock() call is necessary>>
807 cgroup_dbg("Error writing tid %d to
%s:%s\n",
808 tid, path,
strerror(errno));
809 fclose(tasks);
810 last_errno = errno;
811 return ECGOTHER;
812 }
813
814 ret = fflush(tasks);
815 if (ret) {
<<pthread_rwlock_unlock() call is necessary>>
816 last_errno = errno;
817 cgroup_dbg("Error writing tid %d to
%s:%s\n",
818 tid, path,
strerror(errno));
819 fclose(tasks);
820 return ECGOTHER;
821 }
For the readability, this patch merges almost the same lines into one
function(__cgroup_attach_task_pid()) and adds pthread_rwlock_unlock()
call for the case the function fails.
Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Diffstat (limited to 'install-sh')
0 files changed, 0 insertions, 0 deletions