Skip to content

Commit 660042a

Browse files
committed
Addressed review comments
1 parent ffc5e53 commit 660042a

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/safeposix/syscalls/fs_calls.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2567,9 +2567,11 @@ impl Cage {
25672567
"seek to before position 0 in file",
25682568
);
25692569
}
2570-
// subsequent writes to the end of the file must zero pad up until this
2571-
// point if we overran the end of our file when seeking. This is
2572-
// currently supported in write and pwrite syscalls.
2570+
// subsequent writes to the end of the file must zero pad up (filling
2571+
// the gap between the current end of the file and the new position with
2572+
// zero bytes ('\0')) until this point if we overran the end of our file
2573+
// when seeking. This is currently supported in write and pwrite
2574+
// syscalls.
25732575

25742576
// Update the final position of the file descriptor object
25752577
normalfile_filedesc_obj.position = eventualpos as usize;
@@ -3223,7 +3225,7 @@ impl Cage {
32233225
match filedesc_enum {
32243226
//if we are a socket, we dont change disk metadata
32253227
Stream(_) => {} // Stream closing not supported
3226-
Epoll(_) => {} // Epoll closing not implemented yet
3228+
Epoll(_) => {} // TODO: Epoll closing not implemented yet
32273229
Socket(ref mut socket_filedesc_obj) => {
32283230
// Retrieve the socket file descriptor object and get the write
32293231
// lock on the socket handle.
@@ -3261,19 +3263,16 @@ impl Cage {
32613263
let mut inodeobj = FS_METADATA.inodetable.get_mut(&ui.inode).unwrap();
32623264
if let Inode::Socket(ref mut sock) = *inodeobj {
32633265
sock.refcount -= 1;
3264-
if sock.refcount == 0 {
3265-
if sock.linkcount == 0 {
3266-
// Remove the socket from the inode table and the domain
3267-
// socket paths
3268-
// if it is no longer needed.
3269-
drop(inodeobj);
3270-
let path = normpath(
3271-
convpath(sockhandle.localaddr.unwrap().path()),
3272-
self,
3273-
);
3274-
FS_METADATA.inodetable.remove(&inodenum);
3275-
NET_METADATA.domsock_paths.remove(&path);
3276-
}
3266+
if sock.refcount == 0 && sock.linkcount == 0 {
3267+
// Remove the socket from the inode table and the domain
3268+
// socket paths if it is no longer needed.
3269+
drop(inodeobj);
3270+
let path = normpath(
3271+
convpath(sockhandle.localaddr.unwrap().path()),
3272+
self,
3273+
);
3274+
FS_METADATA.inodetable.remove(&inodenum);
3275+
NET_METADATA.domsock_paths.remove(&path);
32773276
}
32783277
}
32793278
}

0 commit comments

Comments
 (0)