Permalink
Browse files

fs: fix appendFile() error using null as function

Code defaulted to 'null' if a callback wasn't provided which would later be called as a function in the case of an error.
Changed to use 'makeCallback' like on 'fs.symlink'.
  • Loading branch information...
1 parent d15bfc0 commit 9c38d69a29e887e171a161f3f38c6c06324d7053 @crazyrobot committed with Aug 10, 2012
Showing with 1 addition and 2 deletions.
  1. +1 −2 lib/fs.js
View
@@ -818,8 +818,7 @@ fs.writeFileSync = function(path, data, encoding) {
fs.appendFile = function(path, data, encoding_, callback) {
var encoding = (typeof(encoding_) == 'string' ? encoding_ : 'utf8');
- var callback_ = arguments[arguments.length - 1];
- callback = (typeof(callback_) == 'function' ? callback_ : null);
+ var callback = makeCallback(arguments[arguments.length - 1]);
fs.open(path, 'a', 438 /*=0666*/, function(err, fd) {
if (err) return callback(err);

0 comments on commit 9c38d69

Please sign in to comment.