Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 311367 Details for
Bug 454617
[RHEL5] Though function write() executed sucessful, sadc end with an error.
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch
sysstat-5.0.5-write.patch (text/plain), 3.84 KB, created by
ritz
on 2008-07-09 12:34:01 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
ritz
Created:
2008-07-09 12:34:01 UTC
Size:
3.84 KB
patch
obsolete
>diff -Naur sysstat-7.0.2.orig/sadc.c sysstat-7.0.2/sadc.c >--- sysstat-7.0.2.orig/sadc.c 2008-07-09 11:31:46.000000000 +0530 >+++ sysstat-7.0.2/sadc.c 2008-07-09 11:37:47.000000000 +0530 >@@ -101,6 +101,32 @@ > > /* > *************************************************************************** >+ * write 'count' bytes from buffer to file fd >+ *************************************************************************** >+ */ >+int write_all(int fd, const char *buffer, int count) >+{ >+ int block, offset = 0; >+ >+ while (count > 0) { >+ block = write(fd, &buffer[offset], count); >+ >+ if (block < 0) { >+ if (errno == EINTR) continue; >+ return block; >+ } >+ if (block == 0) return offset; >+ >+ offset += block; >+ count -= block; >+ } >+ >+ return offset; >+} >+ >+ >+/* >+ *************************************************************************** > * Allocate pid_stats structures > *************************************************************************** > */ >@@ -451,7 +477,7 @@ > file_hdr.sa_release[UTSNAME_LEN - 1] = '\0'; > > /* Write file header */ >- if ((nb = write(fd, &file_hdr, FILE_HDR_SIZE)) != FILE_HDR_SIZE) { >+ if ((nb = write_all(fd, &file_hdr, FILE_HDR_SIZE)) != FILE_HDR_SIZE) { > fprintf(stderr, _("Cannot write system activity file header: %s\n"), > strerror(errno)); > exit(2); >@@ -489,7 +515,7 @@ > file_stats.second = rectime.tm_sec; > > /* Write record now */ >- if ((nb = write(ofd, &file_stats, file_stats_size)) != file_stats_size) >+ if ((nb = write_all(ofd, &file_stats, file_stats_size)) != file_stats_size) > p_write_error(); > } > >@@ -517,37 +543,37 @@ > /* Unable to lock file: wait for next iteration to try again to save data */ > return; > } >- if ((nb = write(ofd, &file_stats, file_stats_size)) != file_stats_size) >+ if ((nb = write_all(ofd, &file_stats, file_stats_size)) != file_stats_size) > p_write_error(); > if (cpu_nr) { >- if ((nb = write(ofd, st_cpu, STATS_ONE_CPU_SIZE * cpu_nr)) != (STATS_ONE_CPU_SIZE * cpu_nr)) >+ if ((nb = write_all(ofd, st_cpu, STATS_ONE_CPU_SIZE * cpu_nr)) != (STATS_ONE_CPU_SIZE * cpu_nr)) > p_write_error(); > } > if (GET_ONE_IRQ(sadc_actflag)) { >- if ((nb = write(ofd, interrupts, STATS_ONE_IRQ_SIZE)) != STATS_ONE_IRQ_SIZE) >+ if ((nb = write_all(ofd, interrupts, STATS_ONE_IRQ_SIZE)) != STATS_ONE_IRQ_SIZE) > p_write_error(); > } > if (pid_nr) { > /* Structures are packed together! */ >- if ((nb = write(ofd, pid_stats[0], PID_STATS_SIZE * pid_nr)) != (PID_STATS_SIZE * pid_nr)) >+ if ((nb = write_all(ofd, pid_stats[0], PID_STATS_SIZE * pid_nr)) != (PID_STATS_SIZE * pid_nr)) > p_write_error(); > } > if (serial_nr) { >- if ((nb = write(ofd, st_serial, STATS_SERIAL_SIZE * serial_nr)) != (STATS_SERIAL_SIZE * serial_nr)) >+ if ((nb = write_all(ofd, st_serial, STATS_SERIAL_SIZE * serial_nr)) != (STATS_SERIAL_SIZE * serial_nr)) > p_write_error(); > } > if (irqcpu_nr) { >- if ((nb = write(ofd, st_irq_cpu, STATS_IRQ_CPU_SIZE * cpu_nr * irqcpu_nr)) >+ if ((nb = write_all(ofd, st_irq_cpu, STATS_IRQ_CPU_SIZE * cpu_nr * irqcpu_nr)) > != (STATS_IRQ_CPU_SIZE * cpu_nr * irqcpu_nr)) > p_write_error(); > } > if (iface_nr) { >- if ((nb = write(ofd, st_net_dev, STATS_NET_DEV_SIZE * iface_nr)) != (STATS_NET_DEV_SIZE * iface_nr)) >+ if ((nb = write_all(ofd, st_net_dev, STATS_NET_DEV_SIZE * iface_nr)) != (STATS_NET_DEV_SIZE * iface_nr)) > p_write_error(); > } > if (disk_nr && GET_DISK(sadc_actflag)) { > /* Disk stats written only if -d option used */ >- if ((nb = write(ofd, st_disk, DISK_STATS_SIZE * disk_nr)) != (DISK_STATS_SIZE * disk_nr)) >+ if ((nb = write_all(ofd, st_disk, DISK_STATS_SIZE * disk_nr)) != (DISK_STATS_SIZE * disk_nr)) > p_write_error(); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 454617
: 311367