1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-24 04:33:24 +00:00
freebsd-ports/lang/tclX/files/patch-uidgid
Mikhail Teterin ad82eb27b8 Upgrade tclX from 8.3.5 to 8.4 released last November after several
years of idleness. The changes are fairly substantial -- all Tk bits,
however insignificant they were, are now removed completely, for
example. No TclX enabled executable is built/installed either -- a Tcl
script is expected to load the Tclx package via the "package require
Tclx" only.

The changes to port add the handling of SIGINFO (made possible by the
recent fix-up of lang/tcl84), running the authors' test-target as part
of the build, and skipping building/installing of help files in the
NOPORTDOCS case.

The devel/tcl-neo is the only dependant port of tclX and is updated to
depend on the new version.
2006-06-27 23:23:20 +00:00

112 lines
3.9 KiB
Plaintext

--- unix/tclXunixId.c Thu Dec 2 22:02:08 1999
+++ unix/tclXunixId.c Fri Jan 10 17:36:50 2003
@@ -41,3 +41,3 @@
UseridToUsernameResult _ANSI_ARGS_((Tcl_Interp *interp,
- int userId));
+ long userId));
@@ -49,3 +49,3 @@
GroupidToGroupnameResult _ANSI_ARGS_((Tcl_Interp *interp,
- int groupId));
+ long groupId));
@@ -149,13 +149,13 @@
static int
UseridToUsernameResult (interp, userId)
Tcl_Interp *interp;
- int userId;
+ long userId;
{
- uid_t uid = (uid_t) userId;
- struct passwd *pw = getpwuid (userId);
+ uid_t uid = (uid_t)userId;
+ struct passwd *pw;
Tcl_Obj *resultObj = Tcl_GetObjResult (interp);
- char userIdString[16];
- if ((pw == NULL) || ((int) uid != userId)) {
- sprintf (userIdString, "%d", uid);
+ if ((long)uid != userId || (pw = getpwuid(uid)) == NULL) {
+ char userIdString[32];
+ sprintf (userIdString, "%ld", userId);
Tcl_AppendStringsToObj (resultObj,
@@ -188,3 +188,3 @@
}
- Tcl_SetObjResult (interp, Tcl_NewIntObj (pw->pw_uid));
+ Tcl_SetObjResult (interp, Tcl_NewIntObj ((int)pw->pw_uid));
endpwent ();
@@ -194,14 +194,13 @@
static int
GroupidToGroupnameResult (interp, groupId)
Tcl_Interp *interp;
- int groupId;
+ long groupId;
{
- gid_t gid = (gid_t) groupId;
- struct group *grp = getgrgid (groupId);
+ gid_t gid = (gid_t)groupId;
+ struct group *grp = getgrgid (gid);
Tcl_Obj *resultObj = Tcl_GetObjResult (interp);
- char groupIdString[16];
-
- sprintf (groupIdString, "%d", gid);
- if ((grp == NULL) || ((int) gid != groupId)) {
+ if ((long)gid != groupId || (grp = getgrgid (gid)) == NULL) {
+ char groupIdString[32];
+ sprintf (groupIdString, "%ld", groupId);
Tcl_AppendStringsToObj (resultObj,
@@ -232,3 +231,3 @@
}
- Tcl_SetIntObj (resultObj, grp->gr_gid);
+ Tcl_SetLongObj (resultObj, (long)grp->gr_gid);
return TCL_OK;
@@ -297,6 +296,6 @@
if (STREQU (subCommand, "user"))
- return UseridToUsernameResult (interp, geteuid ());
+ return UseridToUsernameResult (interp, (long)geteuid ());
if (STREQU (subCommand, "userid")) {
- Tcl_SetObjResult (interp, Tcl_NewIntObj (geteuid ()));
+ Tcl_SetObjResult (interp, Tcl_NewLongObj ((long)geteuid ()));
return TCL_OK;
@@ -305,6 +304,6 @@
if (STREQU (subCommand, "group"))
- return GroupidToGroupnameResult (interp, getegid ());
+ return GroupidToGroupnameResult (interp, (long)getegid ());
if (STREQU (subCommand, "groupid")) {
- Tcl_SetObjResult (interp, Tcl_NewIntObj (getegid ()));
+ Tcl_SetObjResult (interp, Tcl_NewLongObj ((long)getegid ()));
return TCL_OK;
@@ -419,3 +418,3 @@
if (symbolic) {
- int groupId = groups [groupIndex];
+ gid_t groupId = groups [groupIndex];
grp = getgrgid (groupId);
@@ -437,3 +436,3 @@
} else {
- newObj = Tcl_NewIntObj(groups[groupIndex]);
+ newObj = Tcl_NewLongObj((long)groups[groupIndex]);
Tcl_ListObjAppendElement (interp,
@@ -514,3 +513,3 @@
if (objc == 2) {
- return UseridToUsernameResult (interp, getuid ());
+ return UseridToUsernameResult (interp, (long)getuid ());
}
@@ -552,3 +551,3 @@
if (objc == 2) {
- Tcl_SetObjResult (interp, Tcl_NewIntObj (getuid()));
+ Tcl_SetObjResult (interp, Tcl_NewLongObj ((long)getuid()));
return TCL_OK;
@@ -583,3 +582,3 @@
if (objc == 2) {
- return GroupidToGroupnameResult (interp, getgid ());
+ return GroupidToGroupnameResult (interp, (long)getgid ());
}
@@ -621,3 +620,3 @@
if (objc == 2) {
- Tcl_SetIntObj (Tcl_GetObjResult (interp), getgid());
+ Tcl_SetObjResult (interp, Tcl_NewLongObj((long)getgid()));
return TCL_OK;