os/user: Use Entersyscall.
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 13 Jun 2012 05:56:09 +0000 (05:56 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 13 Jun 2012 05:56:09 +0000 (05:56 +0000)
From-SVN: r188496

libgo/go/os/user/lookup_unix.go

index 68f8914d089c5911e11642023bf011727c4e9cd8..ebc8684825db6e5b74a8a10432c264e82ce97f99 100644 (file)
@@ -73,11 +73,14 @@ func lookup(uid int, username string, lookupByName bool) (*User, error) {
        const bufSize = 1024
        buf := make([]byte, bufSize)
        if lookupByName {
-               rv := libc_getpwnam_r(syscall.StringBytePtr(username),
+               p := syscall.StringBytePtr(username)
+               syscall.Entersyscall()
+               rv := libc_getpwnam_r(p,
                        &pwd,
                        &buf[0],
                        bufSize,
                        &result)
+               syscall.Exitsyscall()
                if rv != 0 {
                        return nil, fmt.Errorf("user: lookup username %s: %s", username, syscall.GetErrno())
                }
@@ -85,11 +88,13 @@ func lookup(uid int, username string, lookupByName bool) (*User, error) {
                        return nil, UnknownUserError(username)
                }
        } else {
+               syscall.Entersyscall()
                rv := libc_getpwuid_r(syscall.Uid_t(uid),
                        &pwd,
                        &buf[0],
                        bufSize,
                        &result)
+               syscall.Exitsyscall()
                if rv != 0 {
                        return nil, fmt.Errorf("user: lookup userid %d: %s", uid, syscall.GetErrno())
                }