harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r548185 - /harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c
Date Mon, 18 Jun 2007 03:21:17 GMT
Author: tonywu
Date: Sun Jun 17 20:21:17 2007
New Revision: 548185

URL: http://svn.apache.org/viewvc?view=rev&rev=548185
Log:
add missing method setPlatformExecutable

Modified:
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c?view=diff&rev=548185&r1=548184&r2=548185
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c
Sun Jun 17 20:21:17 2007
@@ -837,7 +837,7 @@
   result = hasPrivilegeInOtherGroups(env, &buffer, S_IXGRP);
   return -1 == result ? (buffer.st_mode & S_IXOTH) != 0 : result;
 }
-
+:
 I_32 
 hasPrivilegeInOtherGroups(JNIEnv * env, struct stat * buffer, mode_t attr) 
 {
@@ -862,4 +862,25 @@
       }
       hymem_free_memory(group);
       return result;    	
+}
+
+I_32
+setPlatformExecutable (JNIEnv * env, char *path, jboolean executable, jboolean ownerOnly)
+{
+  struct stat buffer;
+  mode_t mode;
+  if (stat (path, &buffer))
+    {
+      return 0;
+    }
+  mode = buffer.st_mode;
+  if (executable && ownerOnly)
+	  mode |= S_IXUSR;
+  else if (executable) 
+	  mode |= (S_IXUSR | S_IXGRP | S_IXOTH);
+  else if (ownerOnly)
+  	  mode &= (~S_IXUSR);
+  else
+      mode &= ~(S_IXUSR | S_IXGRP | S_IXOTH);
+  return chmod (path, mode) == 0;
 }



Mime
View raw message