Skip to content

Commit

Permalink
prevent superfluous error log entries
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Fehr committed Mar 11, 2013
1 parent 4c315c5 commit 0d54337
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions libstorage/src/AppUtil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ checkNormalFile(const string& Path_Cv)


bool
getMajorMinor(const string& device, unsigned long& major, unsigned long& minor)
getMajorMinor(const string& device, unsigned long& major, unsigned long& minor, bool may_fail)
{
bool ret = false;
string dev = normalizeDevice(device);
Expand All @@ -167,9 +167,10 @@ checkNormalFile(const string& Path_Cv)
minor = gnu_dev_minor(sbuf.st_rdev);
}
}
else
else
{
y2err("stat for " << device << " failed errno:" << errno << " (" << strerror(errno) << ")");
if( !may_fail )
y2err("stat for " << device << " failed errno:" << errno << " (" << strerror(errno) << ")");
}
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion libstorage/src/AppUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ bool setStatMode(const string& Path_Cv, mode_t val );

bool getStatVfs(const string& path, StatVfs&);

bool getMajorMinor(const string& device, unsigned long& major, unsigned long& minor);
bool getMajorMinor(const string& device, unsigned long& major, unsigned long& minor, bool may_fail=false);


string extractNthWord(int Num_iv, const string& Line_Cv, bool GetRest_bi = false);
Expand Down
2 changes: 1 addition & 1 deletion libstorage/src/Device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ namespace storage
bool
Device::getMajorMinor()
{
return storage::getMajorMinor(dev, mjr, mnr);
return storage::getMajorMinor(dev, mjr, mnr, create);
}


Expand Down
2 changes: 1 addition & 1 deletion libstorage/src/Storage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6257,7 +6257,7 @@ bool Storage::findVolume( const string& device, VolIterator& v, bool also_del,
unsigned long mjr, mnr;
mjr = mnr = 0;
const Device* dev = NULL;
if( !testmode() && getMajorMinor( d, mjr, mnr ) &&
if( !testmode() && getMajorMinor( d, mjr, mnr, true ) &&
(dev=deviceByNumber( mjr, mnr ))!=NULL )
{
v = li->begin();
Expand Down

0 comments on commit 0d54337

Please sign in to comment.