Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

fs: properly handle fd passed to truncate() #9244

Closed
wants to merge 1 commit into from

Conversation

charlanxcc
Copy link

Currently, fs.truncate() silently fails when a file descriptor
is passed as the first argument. This commit changes this
behavior to properly call fs.ftruncate().

PR-URL: #9161
Reviewed-By: Colin Ihrig cjihrig@gmail.com
Reviewed-By: Timothy J Fontaine tjfontaine@gmail.com

Currently, fs.truncate() silently fails when a file descriptor
is passed as the first argument. This commit changes this
behavior to properly call fs.ftruncate().

PR-URL: nodejs#9161
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
@charlanxcc
Copy link
Author

Fix for build issue in 64 bit freebsd.

There are two build fixes. The first is in OS::GetSharedLibraryAddresses(). In this method two automatic variables have the same name: result. I changed one of them to addr to resolve the issue.

The second one is in OS::GetCurrentThreadId(). In here, the code tried to cast pthread_t (64 bit) to int (32 bit), resulting in error. Proper fix should be return type change to long. But as workaround for now, I modified it to ((int) (int64) (void *) pthread_self()) only for freebsd.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants