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 305812 Details for
Bug 447076
[PATCH] do less lstat() in nash
[?]
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]
nash-6.0.19-stat-less.patch
0001-Avoid-doing-lstat-when-readdir-already-gave-us-t.patch (text/plain), 1.80 KB, created by
Adam Jackson
on 2008-05-17 17:34:19 UTC
(
hide
)
Description:
nash-6.0.19-stat-less.patch
Filename:
MIME Type:
Creator:
Adam Jackson
Created:
2008-05-17 17:34:19 UTC
Size:
1.80 KB
patch
obsolete
>From e4575e45facb1bd891380f51b51bdc497f937999 Mon Sep 17 00:00:00 2001 >From: Adam Jackson <ajax@redhat.com> >Date: Sat, 17 May 2008 13:32:39 -0400 >Subject: [PATCH] Avoid doing lstat() when readdir() already gave us the answer. > >--- > nash/devtree.c | 4 +--- > nash/nash.c | 13 ++++++------- > 2 files changed, 7 insertions(+), 10 deletions(-) > >diff --git a/nash/devtree.c b/nash/devtree.c >index 6ced12d..1de16bb 100644 >--- a/nash/devtree.c >+++ b/nash/devtree.c >@@ -1136,7 +1136,6 @@ static int is_sysfs_slave(struct nash_dev_node *adult, > { > DIR *dir; > struct dirent *entry; >- struct stat sb; > int rc = 0; > char slaves[strlen(child->bdev->sysfs_path) + strlen("/slaves") + 1]; > >@@ -1159,8 +1158,7 @@ static int is_sysfs_slave(struct nash_dev_node *adult, > strcpy(devpath, slave); > strcat(devpath, "/dev"); > >- lstat(slave, &sb); >- if (!S_ISLNK(sb.st_mode)) >+ if (entry.d_type == DT_LNK) > continue; > > if (!(df = fopen(devpath, "r"))) >diff --git a/nash/nash.c b/nash/nash.c >index 3c123ab..2d20f12 100644 >--- a/nash/nash.c >+++ b/nash/nash.c >@@ -1052,14 +1052,13 @@ recursiveRemove(char * dirName) > strcat(strBuf, "/"); > strcat(strBuf, d->d_name); > >- if (lstat(strBuf, &sb)) { >- eprintf("failed to stat %s: %m\n", strBuf); >- errno = 0; >- continue; >- } >- > /* only descend into subdirectories if device is same as dir */ >- if (S_ISDIR(sb.st_mode)) { >+ if (d->d_type == DT_DIR) { >+ if (lstat(strBuf, &sb)) { >+ eprintf("failed to stat %s: %m\n", strBuf); >+ errno = 0; >+ continue; >+ } > if (sb.st_dev == rb.st_dev) { > recursiveRemove(strBuf); > if (rmdir(strBuf)) >-- >1.5.4.5 >
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 447076
: 305812