mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
generic: misc cleanups
This commit is contained in:
parent
83ac368076
commit
dc0e7fad7d
1 changed files with 17 additions and 17 deletions
|
@ -159,14 +159,14 @@ char **xstrsep(char *str)
|
||||||
char *ptr = str, *nptr;
|
char *ptr = str, *nptr;
|
||||||
while ((nptr = strchr(ptr, ',')) != 0L)
|
while ((nptr = strchr(ptr, ',')) != 0L)
|
||||||
{
|
{
|
||||||
if (i > size-2)
|
if (i > size-2)
|
||||||
list = xrealloc(list, (size *= 2) * sizeof(char *));
|
list = xrealloc(list, (size *= 2) * sizeof(char *));
|
||||||
*nptr = '\000';
|
*nptr = '\000';
|
||||||
list[i++] = ptr;
|
list[i++] = ptr;
|
||||||
ptr = nptr+1;
|
ptr = nptr+1;
|
||||||
}
|
}
|
||||||
if (*ptr != '\000')
|
if (*ptr != '\000')
|
||||||
list[i++] = ptr;
|
list[i++] = ptr;
|
||||||
list[i] = 0L;
|
list[i] = 0L;
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -264,8 +264,8 @@ int main()
|
||||||
pw = getpwnam(params[P_USER].value);
|
pw = getpwnam(params[P_USER].value);
|
||||||
if (pw == 0L)
|
if (pw == 0L)
|
||||||
{
|
{
|
||||||
printf("kdesu_stub: user %s does not exist!\n", params[P_USER].value);
|
printf("kdesu_stub: user %s does not exist!\n", params[P_USER].value);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
xsetenv("HOME", pw->pw_dir);
|
xsetenv("HOME", pw->pw_dir);
|
||||||
|
|
||||||
|
@ -375,8 +375,8 @@ int main()
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid == -1)
|
if (pid == -1)
|
||||||
{
|
{
|
||||||
perror("kdesu_stub: fork()");
|
perror("kdesu_stub: fork()");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (pid)
|
if (pid)
|
||||||
{
|
{
|
||||||
|
@ -401,15 +401,15 @@ int main()
|
||||||
if (*xauthority)
|
if (*xauthority)
|
||||||
unlink(xauthority);
|
unlink(xauthority);
|
||||||
#endif
|
#endif
|
||||||
exit(xit);
|
exit(xit);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
setsid();
|
setsid();
|
||||||
/* Child: exec command. */
|
/* Child: exec command. */
|
||||||
sprintf(buf, "%s", params[P_COMMAND].value);
|
sprintf(buf, "%s", params[P_COMMAND].value);
|
||||||
dequote(buf);
|
dequote(buf);
|
||||||
execl("/bin/sh", "sh", "-c", buf, (void *)0);
|
execl("/bin/sh", "sh", "-c", buf, (void *)0);
|
||||||
perror("kdesu_stub: exec()");
|
perror("kdesu_stub: exec()");
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue