error: /usr/include/stdio.h: Permission denied 的一种情况分析

代码:

  1. #include <stdio.h>
  2. int main(){
  3. printf ("hello long size %d\n",sizeof(long));
  4. }

很简单,测试是否能够编译通过
对比

  • 在root的用户下编译正常通过
  • 在其他用户测试不通过

    点击(此处)折叠或打开

    1. ~> gcc test.c
    2. test.c:1:19: error: /usr/include/stdio.h: Permission denied
    3. test.c: In function 'main':
    4. test.c:5: warning: incompatible implicit declaration of built-in function 'printf'

尝试着解决问题

提示说是权限受限。
在root用户下看看stdio.h的属性

点击(此处)折叠或打开

  1. ll /usr/include/stdio.h
  2. -rw-r--r-- 1 root root 31144 2010-05-06 10:33 /usr/include/stdio.h

具有可读属性,但是用vim打开,显示是个 [new file], 为什么呢?
具有可读权限就是看不到文件!

给文档添加可执行权限,chmod +x /usr/include/stdio.h
问题如故

给link添加可执行权限,# find /usr/include/ -type l -exec ls -l {} \;
问题如故

去除link的可执行权限,# find /usr/include/ -type l -exec chmod -x  {} \;

给文件夹添加可执行权限,# find /usr/include/ -type d -exec chmod +x  {} \;
问题解决

分析
    我不明白,打开/usr/include/stdio.h 和其他文件夹的可执行权限有什么相关,因为/usr/include和/usr/include/stdio.h 都具有可行性,用户应该可以读取stdio.h文件才对啊。
   
这个情况出现在移植的过程中,为了防止不必要的麻烦,添加如下命令,chmod -R 755 /usr/include/

error: /usr/include/stdio.h: Permission denied 的一种情况分析的更多相关文章

  1. error: /usr/include/objc/objc-class.h: No such file or directory

    When i use the example of ShareKit package,i have come across this error:"error: /usr/include/o ...

  2. #include <stdio.h>

    1 fflush 2 fgetc 3 fgets 4 fprintf 5 fputc 6 fputs 7 fscanf 8 fseek 9 ftell 10 perror 11 remove 12 r ...

  3. 第二次作业#include <stdio.h> int main() { int a,b,c,d,e; printf("请输入一个不多于五位的整数:\n"); scanf("%d",&a); if(a>=100000||a<=0) { printf("输入格式错误! \n"); } else { if(

    1 判断成绩等级 给定一百分制成绩,要求输出成绩的等级.90以上为A,80-89为B,70-79为C,60-69为D,60分以下为E,输入大于100或小于0时输出"输入数据错误". ...

  4. git报错 error: cannot stat ‘'web/js': Permission denied

    切换分支时报错: error: cannot stat ‘'web/js': Permission denied 解决方法:退出编辑器.浏览器.资源管理器等,然后再切换就可以了.

  5. c语言输入与输出库函数#include<stdio.h>

    last modified: 2010-05-28 输入与输出<stdio.h> 头文件<stdio.h>定义了用于输入和输出的函数.类型和宏.最重要的类型是用于声明文件指针的 ...

  6. [pod install] error: cannot open .git/FETCH_HEAD: Permission denied

    pod installAnalyzing dependencies[!] Pod::Executable pull error: cannot open .git/FETCH_HEAD: Permis ...

  7. #include<stdio.h> #include "stdio.h"

    https://baike.baidu.com/item/#include <stdio.h> #include <stdio.h> 编辑 #include<stdio. ...

  8. #include stdio.h(B)

    #include <stdio.h> int main() { //***********一.循环语句*************** //什么叫做循环: //重复的做某件事情,重复的执行一 ...

  9. #include stdio.h(A)

    /* 第一个*******知识点工程相关信息******** 1.创建工程 文件->新建->工程->win32 console applecation ->文件名不能为汉字 2 ...

随机推荐

  1. struct 和 class 不同点

    在 C++ 里面 struct 和 class 没有本质的差别 仅仅是成员和继承方式的默认不同 struct 是 public class 是 private 我的个人建议是仅仅要须要实现成员函数的就 ...

  2. 2008r2 做windows域控制器

    新配一个: 1.装DNS服务. 2.装domain管理. config domain: 客户端172.16.1.34  ping zyctest

  3. sizeof与strlen的区别 浅谈

    1.sizeof operator sizeof是C语言的一种单目操作符,如C语言的其他操作符++.- - 等,它并不是函数. Queries size of the object or type. ...

  4. hdu 2896 病毒侵袭 AC自动机 基础题

    病毒侵袭 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submi ...

  5. uva 10837 - A Research Problem(欧拉功能+暴力)

    题目链接:uva 10837 - A Research Problem 题目大意:给定一个phin.要求一个最小的n.欧拉函数n等于phin 解题思路:欧拉函数性质有,p为素数的话有phip=p−1; ...

  6. 如何在Windows上配置EBS R12.1.3的OAF开发环境

    1.找到想要开发的EBS OAF扩展对应的PATCH,可以参照下面的Note,因为我要做的是R12.1.3的开发,所以要下载p9879989_R12_GENERIC OA Framework - Ho ...

  7. ModelConvertHelper(将DataTable转换成List<model>)

      public class ModelConvertHelper<T> where T : new() {      public static IList<T> Conve ...

  8. ASP.NET利用byte检测上传图片安全

    ) { //这里只测试上传第一张图片file[0] HttpPostedFile file0 = Request.Files[]; //转换成byte,读取图片MIME类型 Stream stream ...

  9. 史上最全的java随机数/字符串生成算法(转)

    代码如下: package com.zuidaima.core.util; import java.util.Random; public class RandomUtil { public stat ...

  10. Windows phone 8 学习笔记

    Windows phone 8 学习笔记(1) 触控输入  http://www.apkbus.com/android-138547-1-1.html Windows phone 8 学习笔记(2) ...