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. mysql HA方案: MHA

    mysql-master-ha mysql 做热备和高可用的方法有很多种, 比如: mmm: http://mysql-mmm.org/ mha: https://code.google.com/p/ ...

  2. AdbWinApi编译详解(本人亲历)

    1. 从微软官方下载WDDK,比如:GRMWDK_EN_7600_1.ISO(http://download.microsoft.com/download/4/A/2/4A25C7D5-EFBE-41 ...

  3. android之View的启动过程

    转自:http://www.cdtarena.com/gpx/201308/9607.html 程序里调用了onSizeChanged方法进行了一些设置,不知道onSizeChanged是在什么时候启 ...

  4. HTML 5与HTML 4的区别

    严重的拖延者患者,本来前天就打算写的,奈何拖到的今天才...(对拖延症有啥好的建议还望留言下,感激不尽...) 过完年了,跳槽蠢蠢欲动了,看些基础知识好应对面试,正好就整理整理... 正文开始 1.推 ...

  5. Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart

    之前都是命令行创建,今天用eclipse装m2eclipse的时候装完后创建项目的时候报错: Could not resolve archetype org.apache.maven.archetyp ...

  6. uoj Goodbye Jiawu

    这次比赛真是太伤我心了. 比(惨)赛(不)结(忍)果(睹) 完挂感言 uoj round 5已经挂了一次了,没想到还要再挂第二次. 这次比赛的期望得分是\(100+100+100+70+10\)的.没 ...

  7. C#中的正则 Regex类

    转义符的总结: 开始数 …………………………………………………………. 3 )Regex.matches() 提取所有符合要求的字符串 string str=@"绩大于80,则奖励50元.语 ...

  8. 64位与32位编程的数据类型区别(C/C++)

    C/C++仅仅定义了这些基本数据类型之间的关系,并没有定义严格定义它们的字长.在不同的平台上,根据编译器不同的实现,它们的字长如下表所示: 数据类型 LP64 ILP64 LLP64 ILP32 LP ...

  9. nest expression &amp; Pyparsing

    http://pyparsing.wikispaces.com/ http://bbs.csdn.net/topics/330052586 C++ boost "<([^<> ...

  10. Cocos2D-X学习笔记 3 从一个场景切换到还有一个场景

    工厂方法一般写法 StartLayer * StartLayer::create() { StartLayer *sl = new StartLayer(); sl->init(); sl-&g ...