libcsdbg  1.28
C++ exception (and generic) stack trace debug library
bool csdbg::util::is_readable ( const fileinfo_t inf)
static

Check if the process has read access to a file.

Parameters
[in]infthe file info
Returns
true if it is readable, false otherwise

Definition at line 445 of file util.cpp.

References likely.

Referenced by csdbg::dictionary::load_file().

446 {
447  if ( likely(geteuid() == inf.st_uid && (inf.st_mode & S_IRUSR)) )
448  return true;
449 
450  if ( likely(getegid() == inf.st_gid && (inf.st_mode & S_IRGRP)) )
451  return true;
452 
453  return inf.st_mode & S_IROTH;
454 }
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor.
Definition: config.hpp:344

+ Here is the caller graph for this function: