~n-muench/ubuntu/oneiric/open-vm-tools/open-vm-tools.fix-836277

« back to all changes in this revision

Viewing changes to hgfsmounter/hgfsmounter.c

  • Committer: Bazaar Package Importer
  • Author(s): Devid Antonio Filoni
  • Date: 2008-08-15 21:21:40 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080815212140-05fhxj8wroosysmj
Tags: 2008.08.08-109361-1ubuntu1
* Merge from Debian unstable (LP: #258393), remaining Ubuntu change:
  - add ubuntu_toolchain_FTBFS.dpatch patch, fix FTBFS
* Update ubuntu_toolchain_FTBFS.dpatch patch for the new version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
#   define MS_SYNCHRONOUS MNT_SYNCHRONOUS
45
45
#   define MS_NOEXEC MNT_NOEXEC
46
46
#   define MS_NOSUID MNT_NOSUID
47
 
#   define MS_NODEV MNT_NODEV
 
47
/*
 
48
 * MNT_NODEV does not exist, or is set to 0, on newer versions of FreeBSD.
 
49
 */
 
50
#   if defined(MNT_NODEV) && MNT_NODEV
 
51
#      define MS_NODEV MNT_NODEV
 
52
#   endif
48
53
#   define MS_UNION MNT_UNION
49
54
#   define MS_ASYNC MNT_ASYNC
50
55
#   define MS_SUIDDIR MNT_SUIDDIR
199
204
   printf("  rw                    mount read-write (default)\n");
200
205
   printf("  nosuid                ignore suid/sgid bits\n");
201
206
   printf("  suid                  allow suid/sgid bits (default)\n");
 
207
#ifdef MS_NODEV
202
208
   printf("  nodev                 prevent device node access\n");
203
209
   printf("  dev                   allow device node access (default)\n");
 
210
#endif
204
211
   printf("  noexec                prevent program execution\n");
205
212
   printf("  exec                  allow program execution (default)\n");
206
213
   printf("  sync                  file writes are synchronous\n");
603
610
      } else if (strcmp(key, "suid") == 0) {
604
611
         *flags &= ~MS_NOSUID;
605
612
         LOG("Setting mount option for allowing suid/sgid bits on\n");
 
613
#ifdef MS_NODEV
606
614
      } else if (strcmp(key, "nodev") == 0) { // allow access to device nodes?
607
615
         *flags |= MS_NODEV;
608
616
         LOG("Setting mount option for accessing device nodes off\n");
609
617
      } else if (strcmp(key, "dev") == 0) {
610
618
         *flags &= ~MS_NODEV;
611
619
         LOG("Setting mount option for accessing device nodes on\n");
 
620
#endif
612
621
      } else if (strcmp(key, "noexec") == 0) { // allow program execution?
613
622
         *flags |= MS_NOEXEC;
614
623
         LOG("Setting mount option for program execution off\n");
737
746
      if (flags & MS_NOSUID) {
738
747
         Str_Strcat(mountEnt.mnt_opts, ",nosuid", MOUNT_OPTS_BUFFER_SIZE);
739
748
      }
 
749
#ifdef MS_NODEV
740
750
      if (flags & MS_NODEV) {
741
751
         Str_Strcat(mountEnt.mnt_opts, ",nodev", MOUNT_OPTS_BUFFER_SIZE);
742
752
      }
 
753
#endif
743
754
      if (flags & MS_NOEXEC) {
744
755
         Str_Strcat(mountEnt.mnt_opts, ",noexec", MOUNT_OPTS_BUFFER_SIZE);
745
756
      }
809
820
   Bool doMtab = TRUE;
810
821
#endif
811
822
   char c;
812
 
   int i, result = EXIT_FAILURE, flags = 0, mntRes = -1;
 
823
   int i;
 
824
   int result = EXIT_FAILURE;
 
825
   int flags = 0;
 
826
   int mntRes = -1;
813
827
   char *optionString = NULL;
814
 
   const char *shareNameHost, *shareNameDir;
 
828
   const char *shareNameHost = NULL;
 
829
   const char *shareNameDir = NULL;
815
830
   struct stat statBuf;
816
831
   HgfsMountInfo mountInfo;
817
832
   char *canonicalizedPath = NULL;
945
960
                            {"target", sizeof("target")},
946
961
                            {shareName, strlen(shareName) + 1},
947
962
                            {"fspath", sizeof("fspath")},
948
 
                            {(void *)mountPoint, strlen(mountPoint) + 1}};
 
963
                            {(void *)mountPoint, strlen(mountPoint) + 1},
 
964
                            {"uidSet", sizeof("uidSet")},
 
965
                            {&mountInfo.uidSet, sizeof(mountInfo.uidSet)},
 
966
                            {"uid", sizeof("uid")},
 
967
                            {&mountInfo.uid, sizeof(mountInfo.uid)},
 
968
                            {"gidSet", sizeof("gidSet")},
 
969
                            {&mountInfo.gidSet, sizeof(mountInfo.gidSet)},
 
970
                            {"gid", sizeof("gid")},
 
971
                            {&mountInfo.gid, sizeof(mountInfo.gid)}};
949
972
 
950
973
      mntRes = nmount(iov, ARRAYSIZE(iov), flags);
951
974
   }
952
975
#elif defined(__APPLE__)
953
 
   mntRes = mount(HGFS_NAME, mountPoint, flags, NULL);
 
976
   mntRes = mount(HGFS_NAME, mountPoint, flags, &mountInfo);
954
977
#endif
955
978
   if (mntRes) {
956
979
      perror("Error: cannot mount filesystem");