Skip to content
  • Kevin J. McCarthy's avatar
    Fix argc==0 handling. · 8a6472f0
    Kevin J. McCarthy authored
    At least on Debian Linux, after invoking getopt() with argc==0, optind
    seems to remain at the default value of 1.
    
    mutt_dotlock was checking for optind==argc to report a missing
    parameter, and would end up invoking the function with the first
    environment variable instead.
    
    mutt, pgpewrap, and mutt_pgpring were assuming argv[0] was non-null,
    so just add a check and hardcode the value in that case to avoid a
    possible segv.
    
    mutt_pgpring allows no arguments.  Its parameters to
    pgpring_find_candidates() would pass the environment list and a
    negative nhints in that case.  The code seem to handle the case, but
    set optind=argc to be clear about it.
    8a6472f0