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. Use Node.js DDP Client on Arduino Yun to Access Meteor Server

    Use Node.js DDP Client on Arduino Yun to Access Meteor Server 概述 在Arduino Yun上安装 Node.js, 并測试与 Meteo ...

  2. 【C语言】数字在排序数组中出现的次数(改动)

    //数字在排序数组中出现的次数(改动) //统计一个数字在排序数组中出现的次数.比如:排序数组{1,2,3,3,3.3,4,5}和数字3,因为3出现了4次,因此输出4. #include <st ...

  3. G-Sensor 校准标准

    在桌面上水平平,自己的前表面. 此时Z轴应+值,和值至9.8大约,x.y轴应0值大约.它是平行于主体x轴,固定的左,提起右侧时,,x轴数值它应0开始增加.直到垂直时,+9.8大约. 为y轴.下面固定. ...

  4. 清华集训2014 day1 task3 奇数国

    题目 题目看起来好像很难的样子!其实不然,这是最简单的一道题. 算法 首先要注意的是: \(number \cdot x + product \cdot y = 1\) ,那么我们称\(number\ ...

  5. POJ 2455 网络流 基础题 二分+网络流 dicnic 以及 sap算法

    Secret Milking Machine Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8189   Accepted: ...

  6. [HTML5实现人工智能]小游戏《井字棋》发布,据说IQ上200才能赢

    一,什么是TicTacToe(井字棋)   本 游戏 为在下用lufylegend开发的第二款小游戏.此游戏是大家想必大家小时候都玩过,因为玩它很简单,只需要一张草稿纸和一只笔就能开始游戏,所以广受儿 ...

  7. JQuery 事件及案例

    JQuery事件与JavaScript事件相似,只是把其中的on去掉 1.click,dblclick事件 案例1:点击缩略图换背景 <html xmlns="http://www.w ...

  8. javascript笔记整理(数组对象)

    1.属性 a.length--设置或返回数组元素的数目 var a=[1,2,3,45,5]; alert(a.length=6) 结果:6 alert(a[5]) 结果:undefined b.co ...

  9. 基于visual Studio2013解决C语言竞赛题之1050矩阵反斜线求和

       题目 解决代码及点评 /************************************************************************/ /* 50 ...

  10. C语言指针和数组知识总结(下)

    一.数组指针: 数组指针就是一个指针,只不过它指向的是一个数组.可以通过如下方式来定义 typedef int Array[5]; //数组类型 Array* m;      //数组定义 还有一种更 ...