- 主题:[SMTH]关于 getuser() 函数使用方法求助
我想通过用户的ID来查询用户信息,用如下语句:
strcpy(uident,"wuweixin");
printf("%s\n",uident);
getuser(uident, &lookupuser);
可以编译通过,但是无法运行,提示:
Segmentation fault
程序放在 local_utl 下执行。
--
FROM 219.216.80.*
需要不需要使用 resolve_boards() 的?
【 在 atppp (Big Mouse) 的大作中提到: 】
: chdir(BBSHOME);
: resolve_ucache();
: 这两句放头上,这样才能挂上shm的指针
: ...................
--
FROM 219.216.80.*
刚刚用 root 执行了一次,现在用 bbs 用户执行就这个样子:
Error! shmat 2 error! key = e6d.: Permission denied
【 在 atppp (Big Mouse) 的大作中提到: 】
: 你这三句程序不需要,但是一般也加上吧,反正这个执行应该很快的。
--
FROM 219.216.80.*
[root@bbs smthbbs-1.2]# ipcs
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 8290304 bbs 660 1024 2 dest
0x00000e74 17825793 bbs 660 1024 7
0x00000000 8355842 bbs 660 11204 2 dest
0x00000e70 17858563 bbs 660 5837252 6
0x00001194 17891332 bbs 660 4798384 4
0x00000e73 17924101 bbs 660 14578200 1
0x00000e72 17956870 bbs 660 224296 1
0x00002335 17989639 bbs 660 60008 1
0x00000e6d 13041674 root 660 11204 5
------ Semaphore Arrays --------
key semid owner perms nsems status
0x00054188 0 bbs 700 20
0x00000000 3735553 bbs 600 1
------ Message Queues --------
key msqid owner perms used-bytes messages
0x00000888 0 bbs 664 0 0
[root@bbs smthbbs-1.2]#
【 在 wuweixin (有颜色的猫) 的大作中提到: 】
: 刚刚用 root 执行了一次,现在用 bbs 用户执行就这个样子:
: Error! shmat 2 error! key = e6d.: Permission denied
--
FROM 219.216.80.*
什么叫 e6d 呀?
【 在 atppp (Big Mouse) 的大作中提到: 】
: e6d的owner变了,你可以把它改回来,或者清共享内存,重启动服务
: 如果你的外部程序一定要root执行,记得开头要
: setuid(BBSUID);
: ...................
--
FROM 219.216.80.*
如果修改权限的话应该是修改 /home/bbs/bin 目录下文件的权限吧?
如果原先目标位置包含文件,则覆盖的文件权限不变吧?
连 lazybm 之类的都不可以用了 ……
【 在 atppp (Big Mouse) 的大作中提到: 】
: 0x00000e6d 13041674 root 660 11204 5
: ~~~
: 你那个错误信息不是写着 e6d permission denied
: ...................
--
FROM 219.216.80.*
for i in `ipcs|grep bbs|awk '{print $2}'`;do ipcrm shm $i;done
ipcs -m | awk '$0~/bbs/ {system(sprintf("ipcrm shm %s",$2));}'
有没好用的清理缓存的脚本啊?我用这两个执行完系统还是有那个
似乎没清理干净。
[root@bbs bin]# ipcs
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 8290304 bbs 660 1024 2 dest
0x00000000 8355842 bbs 660 11204 2 dest
0x00000e6d 13041674 root 660 11204 0
------ Semaphore Arrays --------
key semid owner perms nsems status
0x00054188 0 bbs 700 20
------ Message Queues --------
key msqid owner perms used-bytes messages
0x00000888 0 bbs 664 0 0
[root@bbs bin]#
【 在 wuweixin (有颜色的猫) 的大作中提到: 】
: 如果修改权限的话应该是修改 /home/bbs/bin 目录下文件的权限吧?
: 如果原先目标位置包含文件,则覆盖的文件权限不变吧?
: 连 lazybm 之类的都不可以用了 ……
: ...................
--
FROM 219.216.80.*
for i in `ipcs|awk '{print $2}'`;do ipcrm shm $i;done
这样么?
【 在 atppp (Big Mouse) 的大作中提到: 】
: 不要grep bbs
--
FROM 219.216.80.*
实践结果应该就是这个了 ……
【 在 atppp (Big Mouse) 的大作中提到: 】
: 有点像
--
FROM 219.216.80.*
服务器,重新一次太麻烦了……
肯定明天又会来人问我为什么重新启动了
【 在 atppp (Big Mouse) 的大作中提到: 】
: 我以前碰到这种问题从来都是重启动...
--
FROM 219.216.80.*