Diff for /embedtools/src/cfexec.c between versions 1.5.20.5 and 1.5.20.6

version 1.5.20.5, 2017/10/08 22:34:41 version 1.5.20.6, 2018/01/01 23:48:32
Line 12  terms: Line 12  terms:
 All of the documentation and software included in the ELWIX and AITNET  All of the documentation and software included in the ELWIX and AITNET
 Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>  Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
Copyright 2004 - 2017Copyright 2004 - 2018
         by Michael Pounov <misho@elwix.org>.  All rights reserved.          by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 71  Usage() Line 71  Usage()
                 "\n", compiled, compiledby, compilehost);                  "\n", compiled, compiledby, compilehost);
 }  }
   
   struct statfs *
   getmntpt(const char *name)
   {
           struct statfs *mntbuf;
           int i, mntsize;
   
           mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
           for (i = mntsize - 1; i >= 0; i--) {
                   if (!strcmp(mntbuf[i].f_mntfromname, name) ||
                       !strcmp(mntbuf[i].f_mntonname, name))
                           return &mntbuf[i];
           }
   
           return NULL;
   }
   
 static int  static int
 update(int flags)  update(int flags)
 {  {
         struct ufs_args mnt;          struct ufs_args mnt;
           struct statfs *mntfs = getmntpt(AIT_GET_STR(&Mount));
   
         memset(&mnt, 0, sizeof mnt);          memset(&mnt, 0, sizeof mnt);
        mnt.fspec = AIT_GET_STR(&Dev);        mnt.fspec = mntfs->f_mntfromname;
 #ifdef __NetBSD__  #ifdef __NetBSD__
        if (mount("ufs", AIT_GET_STR(&Mount), flags, &mnt, sizeof mnt) == -1) {        if (mount(mntfs->f_fstypename, mntfs->f_mntonname, flags, &mnt, sizeof mnt) == -1) {
 #else  #else
        if (mount("ufs", AIT_GET_STR(&Mount), flags, &mnt) == -1) {        if (mount(mntfs->f_fstypename, mntfs->f_mntonname, flags, &mnt) == -1) {
 #endif  #endif
                 printf("Error:: can`t update mount %s #%d - %s\n", AIT_GET_STR(&Mount),                   printf("Error:: can`t update mount %s #%d - %s\n", AIT_GET_STR(&Mount), 
                                 errno, strerror(errno));                                  errno, strerror(errno));
Line 325  main(int argc, char **argv) Line 342  main(int argc, char **argv)
                                 if ((f = mkevent(&chg, &evt)) == -1)                                  if ((f = mkevent(&chg, &evt)) == -1)
                                         return 4;                                          return 4;
   
                                if (update(MNT_UPDATE) == -1)                                if (update(MNT_UPDATE) == -1) {
                                        return 5;                                        stat = 5;
                                         goto skip;
                                 }
   
                                 if (Timeout) {                                  if (Timeout) {
                                         memset(&ts, 0, sizeof ts);                                          memset(&ts, 0, sizeof ts);
Line 349  main(int argc, char **argv) Line 368  main(int argc, char **argv)
                                                 if (access(szSLCK, F_OK) && update(MNT_UPDATE | MNT_RDONLY) == -1)                                                  if (access(szSLCK, F_OK) && update(MNT_UPDATE | MNT_RDONLY) == -1)
                                                         stat = 8;                                                          stat = 8;
                                 }                                  }
skip:
                                 close(kq);                                  close(kq);
                                 close(f);                                  close(f);
                                 unlink(szSess);                                  unlink(szSess);
Line 368  main(int argc, char **argv) Line 387  main(int argc, char **argv)
                 else                  else
                         close(f);                          close(f);
   
                if (update(MNT_UPDATE) == -1)                if (update(MNT_UPDATE) == -1) {
                         unlink(szSess);
                         return 5;                          return 5;
                   }
   
                 switch ((pid = vfork())) {                  switch ((pid = vfork())) {
                         case -1:                          case -1:

Removed from v.1.5.20.5  
changed lines
  Added in v.1.5.20.6


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>