X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=cde%2Fprograms%2Fdtaction%2FMain.c;h=eb1bc4e2c597f107579db5833cc5430aedabdb8f;hb=164e695cd027f712205c433f69c2a937f9e7397a;hp=866ec8db76ad7259ee22961e79c7ecece5d6f175;hpb=0ecef859cfacb5118ef489be5b09b2cde7a70195;p=oweals%2Fcde.git diff --git a/cde/programs/dtaction/Main.c b/cde/programs/dtaction/Main.c index 866ec8db..eb1bc4e2 100644 --- a/cde/programs/dtaction/Main.c +++ b/cde/programs/dtaction/Main.c @@ -16,7 +16,7 @@ * details. * * You should have received a copy of the GNU Lesser General Public - * License along with these librararies and programs; if not, write + * License along with these libraries and programs; if not, write * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth * Floor, Boston, MA 02110-1301 USA */ @@ -40,6 +40,7 @@ **************************************************************************** ************************************<+>*************************************/ +#include #include #include #include @@ -48,7 +49,7 @@ #include #include /* for MAXPATHLEN and MAXHOSTNAMELEN */ -#ifdef sun +#if defined(sun) || defined(linux) #include #include #endif @@ -60,6 +61,7 @@ #include #include #include +#include #include #include #include @@ -86,12 +88,6 @@ XrmOptionDescRec option_list[] = { "-termOpts", "termOpts", XrmoptionSepArg, NULL}, }; -/* Fallback Resources */ -static char *fallback_resources[] = { - "*timeout: 5", - (char *) NULL -}; - typedef struct { char * user; char * contextDir; @@ -280,7 +276,7 @@ CheckForDone( } -void +int main( int argc, char **argv ) @@ -290,7 +286,6 @@ main( int n=0; char *actionName; int numArgs = 0; - char contextDir[MAXPATHLEN+1]; DtActionArg *ap = NULL; XtSetLanguageProc(NULL, NULL, NULL); @@ -306,7 +301,7 @@ main( &argc, argv)) ) { setlocale(LC_ALL, ""); - fprintf(stderr,GETMESSAGE(1,11,"Can't open display.\n")); + fprintf(stderr, "%s", GETMESSAGE(1,11,"Can't open display.\n")); exit(-1); } @@ -351,7 +346,7 @@ main( */ if ( (actionName = argv[1]) == NULL) { - fprintf(stderr,GETMESSAGE(1,10,"No action name specified.\n")); + fprintf(stderr, "%s", GETMESSAGE(1,10,"No action name specified.\n")); exit(-1); } @@ -397,6 +392,7 @@ main( XtAppMainLoop(appContext); + return EXIT_SUCCESS; } @@ -407,8 +403,10 @@ SetGidUid ( unsigned short rgid, unsigned short ruid ) /* fix process gid */ #if defined(SVR4) || defined(_AIX) setgid(rgid); -#elif defined(__osf__) || defined(linux) || defined(CSRG_BASED) - setregid(rgid, rgid); +#elif defined(linux) || defined(CSRG_BASED) + if(-1 == setregid(rgid, rgid)) { + fprintf(stderr, "SetGidUid: setregid failed on %d\n", rgid); + } #elif defined(__hpux) setresgid(rgid, rgid, rgid); #else @@ -418,8 +416,10 @@ SetGidUid ( unsigned short rgid, unsigned short ruid ) /* fix process uid */ #if defined (SVR4) || defined (_AIX) setuid(ruid); -#elif defined(__osf__) || defined(linux) || defined(CSRG_BASED) - setreuid(ruid, ruid); +#elif defined(linux) || defined(CSRG_BASED) + if(-1 == setreuid(ruid, ruid)) { + fprintf(stderr, "SetGidUid: setreuid failed on %d\n", ruid); + } #elif defined(__hpux) setresuid(ruid, ruid, ruid); #else @@ -1006,9 +1006,7 @@ LogSuccess( void ) /* Set up the user's new id's */ SetGidUid(basegid,newuid); -#ifndef sco initgroups(appArgs.user, basegid); -#endif }