freebsd-ports/x11/kdelibs3/files/patch-kdesu::process.cpp
Will Andrews 56067c5970 Bring in a -real- fix for kdesu. Many thanks to Alan Eldridge and
Waldo Bastian for their work towards fixing this both in 2.2.2/ports
and KDE3 CVS.  Bump PORTREVISION to make sure people get *this* fix and
not the previous broken one.

PR:		32549 (for real this time)
Submitted by:	Alan Eldridge <alane@geeksrus.net>,
		Waldo Bastian <bastian@kde.org>
2002-01-21 04:26:32 +00:00

39 lines
1.1 KiB
C++

--- kdesu/process.cpp.orig Sat Feb 17 21:03:18 2001
+++ kdesu/process.cpp Fri Jan 11 21:23:41 2002
@@ -120,13 +120,16 @@
kdError(900) << k_lineinfo << "fcntl(F_GETFL): " << perror << "\n";
return ret;
}
+ int oflags = flags;
if (block)
flags &= ~O_NONBLOCK;
else
flags |= O_NONBLOCK;
- if (fcntl(m_Fd, F_SETFL, flags) < 0)
+
+ if ((flags != oflags) && (fcntl(m_Fd, F_SETFL, flags) < 0))
{
- kdError(900) << k_lineinfo << "fcntl(F_SETFL): " << perror << "\n";
+ // We get an error here when the child process has closed
+ // the file descriptor already.
return ret;
}
@@ -231,12 +234,12 @@
path = QFile::encodeName(file);
}
- int i;
- const char * argp[32];
- argp[0] = path;
- QCStringList::Iterator it;
- for (i=1, it=args.begin(); it!=args.end() && i<31; it++)
+ const char **argp = (const char **)malloc((args.count()+2)*sizeof(char *));
+ int i = 0;
+ argp[i++] = path;
+ for (QCStringList::ConstIterator it=args.begin(); it!=args.end(); it++)
argp[i++] = *it;
+
argp[i] = 0L;
execv(path, (char * const *)argp);