Skip to content
This repository was archived by the owner on Jun 9, 2020. It is now read-only.

Commit 34db718

Browse files
committed
Fix the wrong offset in alloc fdtable
1 parent 296fa1d commit 34db718

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/fs/fs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,12 @@ alloc_fdtable(struct fdtable *fdtable, int newsize)
119119
fdtable->cloexec_fds = realloc(fdtable->cloexec_fds, newfdslen);
120120
if (fdtable->cloexec_fds == NULL)
121121
return -LINUX_ENOMEM;
122+
122123
int offset = oldsize / 8;
123124
int size = newfdslen - offset;
124-
bzero(fdtable->open_fds + offset, size);
125-
bzero(fdtable->cloexec_fds + offset, size);
125+
126+
bzero(fdtable->open_fds + oldunit, size);
127+
bzero(fdtable->cloexec_fds + oldunit, size);
126128

127129
fdtable->size = newsize;
128130
return 0;

0 commit comments

Comments
 (0)