uid-number@0.0.5

This commit is contained in:
isaacs
2014-02-20 08:04:17 -08:00
parent 14e650bce0
commit d50b826b9e
4 changed files with 6 additions and 31 deletions

25
node_modules/uid-number/LICENCE generated vendored
View File

@@ -1,25 +0,0 @@
Copyright (c) Isaac Z. Schlueter
All rights reserved.
The BSD License
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

View File

@@ -6,7 +6,7 @@
},
"name": "uid-number",
"description": "Convert a username/group name to a uid/gid number",
"version": "0.0.4",
"version": "0.0.5",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/uid-number.git"
@@ -25,6 +25,6 @@
"url": "https://github.com/isaacs/uid-number/issues"
},
"homepage": "https://github.com/isaacs/uid-number",
"_id": "uid-number@0.0.4",
"_id": "uid-number@0.0.5",
"_from": "uid-number@latest"
}

View File

@@ -18,7 +18,7 @@ function uidNumber (uid, gid, cb) {
if (typeof cb !== "function") cb = uid, uid = null
if (gid == null) gid = process.getgid()
if (uid == null) uid = process.getuid()
if (!isNaN(gid)) gid = uidCache[gid] = +gid
if (!isNaN(gid)) gid = gidCache[gid] = +gid
if (!isNaN(uid)) uid = uidCache[uid] = +uid
if (uidCache.hasOwnProperty(uid)) uid = uidCache[uid]
@@ -33,7 +33,7 @@ function uidNumber (uid, gid, cb) {
child_process.execFile( process.execPath
, [getter, uid, gid]
, function (code, out, err) {
if (err) return cb(new Error("could not get uid/gid\n" + err))
if (er) return cb(new Error("could not get uid/gid\n" + err))
try {
out = JSON.parse(out+"")
} catch (ex) {
@@ -49,6 +49,6 @@ function uidNumber (uid, gid, cb) {
if (isNaN(out.uid) || isNaN(out.gid)) return cb(new Error(
"Could not get uid/gid: "+JSON.stringify(out)))
cb(null, uidCache[uid] = +out.uid, uidCache[gid] = +out.gid)
cb(null, uidCache[uid] = +out.uid, gidCache[gid] = +out.gid)
})
}