Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
You need to sign in or sign up before continuing.
  • linux
  • scripts
  • ver_linux
Find file BlameHistoryPermalink
  • Alexander Kapshuk's avatar
    ver_linux: Drop redundant calls to system() to test if file is readable · 1c9a4be5
    Alexander Kapshuk authored May 12, 2018
    
    
    Running 'test -r' on an awk variable name whose value is an empty
    string results in test being run with no arguments, and causes system()
    to return 0, which indicates success when used to test values returned
    by function calls. This results in code within the if blocks being run
    when it should not be.
    Instead of testing if a file is accessible and readable via calls to
    system("test -r " file), rely on the value returned by getline to perform
    this kind of testing. Getline returns -1 on error, with the code within
    the while loops not being run.
    
    Signed-off-by: default avatarAlexander Kapshuk <alexander.kapshuk@gmail.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    1c9a4be5
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7