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 154301 Details for
Bug 226997
udevd read buffer too small.
[?]
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 against udev-110 accepted upstream.
udev-proc-buffer.patch (text/plain), 2.33 KB, created by
George Beshers
on 2007-05-07 21:50:25 UTC
(
hide
)
Description:
Patch against udev-110 accepted upstream.
Filename:
MIME Type:
Creator:
George Beshers
Created:
2007-05-07 21:50:25 UTC
Size:
2.33 KB
patch
obsolete
>diff --git a/udevd.c b/udevd.c >index 645b068..4086b96 100644 >--- a/udevd.c >+++ b/udevd.c >@@ -318,61 +318,42 @@ static void msg_queue_insert(struct udev > > static int mem_size_mb(void) > { >- int f; >- char buf[8192]; >- long int len; >- const char *pos; >- long int memsize; >- >- f = open("/proc/meminfo", O_RDONLY); >- if (f == -1) >- return -1; >- >- len = read(f, buf, sizeof(buf)-1); >- close(f); >+ FILE* f; >+ char buf[1024]; >+ long int memsize = -1; > >- if (len <= 0) >+ f = fopen("/proc/meminfo", "r"); >+ if (f == NULL) > return -1; >- buf[len] = '\0'; > >- pos = strstr(buf, "MemTotal: "); >- if (pos == NULL) >- return -1; >+ while (fgets(buf, sizeof(buf), f) != NULL) { >+ long int value; > >- if (sscanf(pos, "MemTotal: %ld kB", &memsize) != 1) >- return -1; >+ if (sscanf(buf, "MemTotal: %ld kB", &value) == 1) { >+ memsize = value / 1024; >+ break; >+ } >+ } > >- return memsize / 1024; >+ return memsize; > } > > static int cpu_count(void) > { >- int f; >- char buf[65536]; >- int len; >- const char *pos; >+ FILE* f; >+ char buf[1024]; > int count = 0; > >- f = open("/proc/stat", O_RDONLY); >- if (f == -1) >+ f = fopen("/proc/stat", "r"); >+ if (f == NULL) > return -1; > >- len = read(f, buf, sizeof(buf)-1); >- close(f); >- if (len <= 0) >- return -1; >- buf[len] = '\0'; >- >- pos = strstr(buf, "cpu"); >- if (pos == NULL) >- return -1; >- >- while (pos != NULL) { >- if (strncmp(pos, "cpu", 3) == 0 &&isdigit(pos[3])) >+ while (fgets(buf, sizeof(buf), f) != NULL) { >+ if (strncmp(buf, "cpu", 3) == 0 && isdigit(buf[3])) > count++; >- pos = strstr(&pos[3], "cpu"); > } > >+ fclose(f); > if (count == 0) > return -1; > return count; >@@ -380,29 +361,24 @@ static int cpu_count(void) > > static int running_processes(void) > { >- int f; >- char buf[32768]; >- int len; >- int running; >- const char *pos; >+ FILE* f; >+ char buf[1024]; >+ int running = -1; > >- f = open("/proc/stat", O_RDONLY); >- if (f == -1) >+ f = fopen("/proc/stat", "r"); >+ if (f == NULL) > return -1; > >- len = read(f, buf, sizeof(buf)-1); >- close(f); >- if (len <= 0) >- return -1; >- buf[len] = '\0'; >- >- pos = strstr(buf, "procs_running "); >- if (pos == NULL) >- return -1; >+ while (fgets(buf, sizeof(buf), f) != NULL) { >+ int value; > >- if (sscanf(pos, "procs_running %u", &running) != 1) >- return -1; >+ if (sscanf(buf, "procs_running %u", &value) == 1) { >+ running = value; >+ break; >+ } >+ } > >+ fclose(f); > return running; > } >
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 226997
:
149299
|
153906
|
154301
|
156355