Fossil

Check-in [1c0b1a58]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Since the intent of the TH1 'hascap' command is that all specified permissions are required (i.e. the first missing permission should stop further checks), correct the loop invariant.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1c0b1a58c60328c2b5710a9c7ab100f015b05b11
User & Date: mistachkin 2016-08-18 02:22:57
Context
2016-08-18
02:45
Make the '--th-trace' option work properly on Windows. check-in: 11d3d721 user: mistachkin tags: trunk
02:22
Since the intent of the TH1 'hascap' command is that all specified permissions are required (i.e. the first missing permission should stop further checks), correct the loop invariant. check-in: 1c0b1a58 user: mistachkin tags: trunk
02:11
Further enhancements to TH1 permissions testing. check-in: 5915e6f4 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/th_main.c.

634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
static int hascapCmd(
  Th_Interp *interp,
  void *p,
  int argc,
  const char **argv,
  int *argl
){
  int rc = 0, i;
  if( argc<2 ){
    return Th_WrongNumArgs(interp, "hascap STRING ...");
  }
  for(i=1; i<argc && rc==0; i++){
    rc = login_has_capability((char*)argv[i],argl[i],*(int*)p);
  }
  if( g.thTrace ){
    Th_Trace("[hascap %#h] => %d<br />\n", argl[1], argv[1], rc);
  }
  Th_SetResultInt(interp, rc);
  return TH_OK;







|



|







634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
static int hascapCmd(
  Th_Interp *interp,
  void *p,
  int argc,
  const char **argv,
  int *argl
){
  int rc = 1, i;
  if( argc<2 ){
    return Th_WrongNumArgs(interp, "hascap STRING ...");
  }
  for(i=1; rc==1 && i<argc; i++){
    rc = login_has_capability((char*)argv[i],argl[i],*(int*)p);
  }
  if( g.thTrace ){
    Th_Trace("[hascap %#h] => %d<br />\n", argl[1], argv[1], rc);
  }
  Th_SetResultInt(interp, rc);
  return TH_OK;