On Tue, Aug 03, 2010 at 05:20:11PM +0100, Matthew Booth wrote:
+#define CORE_PATTERN "/proc/sys/kernel/core_pattern"
+ int fd = open (CORE_PATTERN, O_WRONLY);
+ if (fd == -1) {
+ reply_with_error ("open: " CORE_PATTERN);
+ }
+ if (write (fd, pattern, pattern_len) < (ssize_t) pattern_len) {
+ reply_with_error ("write: " CORE_PATTERN);
+ }
+ if (close (fd) == -1) {
+ reply_with_error ("close: " CORE_PATTERN);
+ }
+
+ struct rlimit limit = {
+ .rlim_cur = RLIM_INFINITY,
+ .rlim_max = RLIM_INFINITY
+ };
+ if (setrlimit (RLIMIT_CORE, &limit) == -1) {
+ reply_with_error ("setrlimit (RLIMIT_CORE)");
+ }
Several missing 'return NULL' statements here ...
However the concept of the patch is good and I'd be prepared
to commit it if it was fixed.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v