Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed some issues after codereview

  • Loading branch information...
commit 030e7e5520421245e485f1f01c8df0c79d84dd0e 1 parent e86efab
@elwerene elwerene authored
Showing with 5 additions and 22 deletions.
  1. +0 −18 example/jsonFS.js
  2. +5 −4 fuse4js.cc
View
18 example/jsonFS.js
@@ -390,24 +390,6 @@ function init(cb) {
//---------------------------------------------------------------------------
/*
- * Handler for the destroy() FUSE hook. You can perform clean up tasks here.
- * cb: a callback to call when you're done. It takes no arguments.
- */
-function destroy(cb) {
- if (options.outJson) {
- try {
- fs.writeFileSync(options.outJson, JSON.stringify(obj, null, ' '), 'utf8');
- } catch (e) {
- console.log("Exception when writing file: " + e);
- }
- }
- console.log("File system stopped");
- cb();
-}
-
-//---------------------------------------------------------------------------
-
-/*
* Handler for the setxattr() FUSE hook.
* The arguments differ between different operating systems.
* Darwin(Mac OSX):
View
9 fuse4js.cc
@@ -387,11 +387,12 @@ void *fuse_thread(void *)
const char* debugOption = f4js.enableFuseDebug? "-d":"-f";
char *argv[] = { (char*)"dummy", (char*)"-s", (char*)debugOption, (char*)f4js.root.c_str() };
- char **argvIncludingExtraArgs = (char**)malloc(sizeof(argv)+sizeof(char*)*f4js.extraArgc);
+ int initialArgc = sizeof(argv) / sizeof(char*);
+ char **argvIncludingExtraArgs = (char**)malloc(sizeof(char*) * (initialArgc + f4js.extraArgc));
memcpy(argvIncludingExtraArgs, argv, sizeof(argv));
- memcpy(argvIncludingExtraArgs+sizeof(argv)/sizeof(char*), f4js.extraArgv, sizeof(char*)*f4js.extraArgc);
+ memcpy(argvIncludingExtraArgs + initialArgc, f4js.extraArgv, sizeof(char*) * f4js.extraArgc);
- if (fuse_main((sizeof(argv)/sizeof(char*) + f4js.extraArgc), argvIncludingExtraArgs, &ops, NULL)) {
+ if (fuse_main((initialArgc + f4js.extraArgc), argvIncludingExtraArgs, &ops, NULL)) {
// Error occured
f4js_destroy(NULL);
}
@@ -813,6 +814,7 @@ Handle<Value> Start(const Arguments& args)
f4js.enableFuseDebug = debug->BooleanValue();
}
+ f4js.extraArgc = 0;
if (args.Length() >= 4) {
if (!args[3]->IsArray()) {
ThrowException(Exception::TypeError(String::New("Wrong argument types")));
@@ -821,7 +823,6 @@ Handle<Value> Start(const Arguments& args)
Handle<Array> mountArgs = Handle<Array>::Cast(args[3]);
f4js.extraArgv = (char**)malloc(mountArgs->Length() * sizeof(char*));
- f4js.extraArgc = 0;
for (uint32_t i = 0; i < mountArgs->Length(); i++) {
Local<Value> arg = mountArgs->Get(i);
Please sign in to comment.
Something went wrong with that request. Please try again.