glibc + uid ?
V13
v13 at priest.com
Tue Aug 27 22:31:01 EEST 2002
Mporei na moy eksigisei kapoios an ayto einai sfalma ths glibc h kapoioy
alloy?
Sto /usr/include/bits/types.h exei:
typedef __u_int __uid_t; /* Type of user identifications. */
typedef __u_int __gid_t; /* Type of group identifications. */
Eno sto man ths chown(2) leei kathara:
int chown(const char *path, uid_t owner, gid_t group);
If the owner or group is specified as -1, then that ID is
not changed.
To opoio kai doylevei alla me tin katallili xorodia:
hell:/tmp$ cat a.cc
#include "sys/types.h"
#include "unistd.h"
int main()
{
chown ("/dev/null",-1,-1);
}
hell:/tmp$ g++ a.cc
a.cc: In function `int main()':
a.cc:6: warning: passing negative value `-1' for argument passing 2 of `int
chown(const char*, unsigned int, unsigned int)'
a.cc:6: warning: argument of negative value `-1' to `unsigned int'
a.cc:6: warning: passing negative value `-1' for argument passing 3 of `int
chown(const char*, unsigned int, unsigned int)'
a.cc:6: warning: argument of negative value `-1' to `unsigned int'
sto opoio tygxanei na exei apolyto dikio o compiler...
ase poy les:
uid_t u;
u=-1;
if (u<0) { exit(0); }
kai den doylevei, eno tha perimenes oti symfvna me to man ths chown(2) kati
tetoio einai dynato.. kai edo soy petaei:
a.cc:9: warning: assignment of negative value `-1' to `uid_t'
WTF?
<<V13>>
p.s. kai to zori tis ypotheseis einai oti den mporeis na apalageis apo ayta ta
warnings, ektos kai an katafygeis se alximies me signed kai unsigned.
More information about the Linux-greek-users
mailing list