diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2011-07-04 14:29:59 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2011-07-04 17:23:14 +0200 |
commit | bd0baf23383951182b10261b076cf6268152a68b (patch) | |
tree | 2658b53235ef16b606577b1f9ae60c1e7f2768a9 /src | |
parent | 8e0d788842fb831d70cc640ac124c4dee7e450ef (diff) | |
download | node-bd0baf23383951182b10261b076cf6268152a68b.tar.gz |
Check that PR_SET_NAME is defined.
Avoids breaking the build with older (pre-2006) linux kernels.
Raises a JS exception if the script tries to assign to `process.title`.
Fixes #840.
Diffstat (limited to 'src')
-rw-r--r-- | src/platform_linux.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/platform_linux.cc b/src/platform_linux.cc index 54937b487..827b8d4ea 100644 --- a/src/platform_linux.cc +++ b/src/platform_linux.cc @@ -64,9 +64,15 @@ char** Platform::SetupArgs(int argc, char *argv[]) { void Platform::SetProcessTitle(char *title) { +#ifdef PR_SET_NAME if (process_title) free(process_title); process_title = strdup(title); prctl(PR_SET_NAME, process_title); +#else + Local<Value> ex = Exception::Error( + String::New("'process.title' is not writable on your system, sorry.")); + ThrowException(ex); // Safe, this method is only called from the main thread. +#endif } |