/[winpt]/trunk/Src/wptGPG.cpp
ViewVC logotype

Diff of /trunk/Src/wptGPG.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 408 by twoaday, Mon Feb 6 19:26:03 2012 UTC revision 409 by twoaday, Mon Feb 6 19:39:00 2012 UTC
# Line 637  check_gnupg_options (const char *buf, in Line 637  check_gnupg_options (const char *buf, in
637  /* Store the last access of the file inside the watcher @ctx. */  /* Store the last access of the file inside the watcher @ctx. */
638  static int  static int
639  get_last_gnupg_access (gpg_monitor_t ctx)  get_last_gnupg_access (gpg_monitor_t ctx)
640  {  {    
641      HANDLE fd;      HANDLE fd = CreateFile (ctx->fpath_object, GENERIC_READ, FILE_SHARE_READ,
642                                NULL, OPEN_EXISTING, 0, NULL);
     fd = CreateFile (ctx->fpath_object, GENERIC_READ, FILE_SHARE_READ,  
                      NULL, OPEN_EXISTING, 0, NULL);  
643      if (fd == INVALID_HANDLE_VALUE)      if (fd == INVALID_HANDLE_VALUE)
644          return WPTERR_FILE_OPEN;          return WPTERR_FILE_OPEN;
645      GetFileTime (fd, NULL, NULL, &ctx->access);      GetFileTime (fd, NULL, NULL, &ctx->access);
# Line 672  check_last_gnupg_access (gpg_monitor_t c Line 670  check_last_gnupg_access (gpg_monitor_t c
670  void  void
671  init_gnupg_table (void)  init_gnupg_table (void)
672  {        {      
673      char *path;      char *path = get_gnupg_path ();
674      int j;      for (int j = 0; j < gpg_table_count; j++) {
   
     path = get_gnupg_path ();  
     for (j = 0; j < gpg_table_count; j++) {  
675          gpg_table[j].object = m_strdup (gpg_objs[j]);          gpg_table[j].object = m_strdup (gpg_objs[j]);
676          gpg_table[j].fpath_object = make_filename (path, gpg_objs[j], NULL);          gpg_table[j].fpath_object = make_filename (path, gpg_objs[j], NULL);
677          memset (&gpg_table[j].access, 0, sizeof (FILETIME));          memset (&gpg_table[j].access, 0, sizeof (FILETIME));
# Line 691  init_gnupg_table (void) Line 686  init_gnupg_table (void)
686  void  void
687  free_gnupg_table (void)  free_gnupg_table (void)
688  {  {
689      for (int j=0; j < gpg_table_count; j++) {      for (int j = 0; j < gpg_table_count; j++) {
690          free_if_alloc (gpg_table[j].object);          free_if_alloc (gpg_table[j].object);
691          free_if_alloc (gpg_table[j].fpath_object);          free_if_alloc (gpg_table[j].fpath_object);
692      }      }
# Line 702  free_gnupg_table (void) Line 697  free_gnupg_table (void)
697  int  int
698  keyring_check_last_access (void)  keyring_check_last_access (void)
699  {  {
700      int nfiles;      int nfiles = 0;
   
     nfiles = 0;  
701      for (int pos = 0; pos < gpg_table_count; pos++) {      for (int pos = 0; pos < gpg_table_count; pos++) {
702          get_last_gnupg_access (&gpg_table[pos]);          get_last_gnupg_access (&gpg_table[pos]);
703          check_last_gnupg_access (&gpg_table[pos]);          check_last_gnupg_access (&gpg_table[pos]);
# Line 749  gnupg_check_file_ext (const char *fname, Line 742  gnupg_check_file_ext (const char *fname,
742  static int  static int
743  check_file_access (const char *fname, int mode)  check_file_access (const char *fname, int mode)
744  {  {
     HANDLE hd;  
   
745      if (!mode)      if (!mode)
746          mode = FILE_SHARE_WRITE;          mode = FILE_SHARE_WRITE;
747      hd = CreateFile (fname, GENERIC_WRITE, mode,      HANDLE hd = CreateFile (fname, GENERIC_WRITE, mode,
748                       NULL, OPEN_EXISTING, 0, NULL);                              NULL, OPEN_EXISTING, 0, NULL);
749      if (hd == INVALID_HANDLE_VALUE)      if (hd == INVALID_HANDLE_VALUE)
750          return -1;          return -1;
751      CloseHandle (hd);      CloseHandle (hd);
# Line 993  check_keyring (char **r_path) Line 984  check_keyring (char **r_path)
984      if (!*r_path)      if (!*r_path)
985          return 0;          return 0;
986      p = make_filename (*r_path, "pubring", "gpg");      p = make_filename (*r_path, "pubring", "gpg");
987      if (get_file_size (p) <= 0)      if (!p || get_file_size (p) < 1)
988          return 0;          return 0;
989    
990      opt = get_gnupg_cfgfile ();      opt = get_gnupg_cfgfile ();

Legend:
Removed from v.408  
changed lines
  Added in v.409

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26