使用给出错误的文件权限

时间:2015-08-17 06:29:44

标签: c linux unix

我有一个小片段

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.hothyfa.recyclerandmore/com.example.hothyfa.recyclerandmore.MainActivity}: android.view.InflateException: Binary XML file line #19: Error inflating class fragment at app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) at \\\\\\\android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5257) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class fragment at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763) at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) at android.view.LayoutInflater.inflate(LayoutInflater.java:504) at android.view.LayoutInflater.inflate(LayoutInflater.java:414) at android.view.LayoutInflater.inflate(LayoutInflater.java:365) at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106) at com.example.hothyfa.recyclerandmore.MainActivity.onCreate(MainActivity.java:19) at android.app.Activity.performCreate(Activity.java:5990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)      错误地给了我许可。

当我做fd = open("data", O_RDONLY | O_CREAT, 0666)时,我得到了这个 ls -l data

有人可以说出错了吗?

注意:在koding.com我得到这样的许可
-rw------- 1 mayukhsarkar staff 0 Aug 17 11:44 data

已解决: umask(000)在开放系统调用之前完成了这个技巧

1 个答案:

答案 0 :(得分:1)

您传递的模式不正确。它需要作为第三个参数传递:

open("data", O_RDONLY | O_CREAT, 0666);

请注意,使用O_RDONLY创建文件并没有多大意义,因为在创建文件后您将无法写入文件...