Results 1 to 3 of 3
Hi,
i have Ubuntu10.10 (kernel-2.6.35-22-generic) installed.
struct stat StatBuff;
Example1:
iRet = stat("/mnt/win/data", &Statuff);
if (-1 == iRet)
{
perror("statfail");
}
Example2:
pDir = opendir("/mnt/win/data");
if (NULL != pDir)
{
...
- 12-29-2010 #1Just Joined!
- Join Date
- May 2009
- Posts
- 6
Problem with stat on cifs.
Hi,
i have Ubuntu10.10 (kernel-2.6.35-22-generic) installed.
struct stat StatBuff;
Example1:
iRet = stat("/mnt/win/data", &Statuff);
if (-1 == iRet)
{
perror("statfail");
}
Example2:
pDir = opendir("/mnt/win/data");
if (NULL != pDir)
{
if ((dp = readdir(pDir)) != NULL)
{
iRet = stat(dp->d_name, &StatBuff);
if (-1 == iRet)
{
perror("statfail");
}
}
}
I have mounted a windows share folder on /mnt. When i gave any directory within /mnt/ to stat function it fails with errorno 75. perror shows "Value too large for defined data type".
Example 1 is fail but Example 2 works fine.
Can any one tell me meanning of error or why Example 1 gets fail here?
Please help me. Its urgent.
- 12-30-2010 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
I assume in Example1 that you really meant &StatBuff and not &Statuff? Why the call would fail in the first example, but not the second I have to assume it is because you have not opened the connection to the remote directory first. Whether this is a bug or not is a good question. So, I would recommend in your second example to try using the string literal "/mnt/win/data" in your call to stat() instead of dp->d_name, as an experiment to see if it is in the use of the literal const char* vs the member variable of the dirent structure filled in by readdir(). Let us know what you find.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 12-30-2010 #3Just Joined!
- Join Date
- May 2009
- Posts
- 6
using option "noserverino, nounix" while mount solved the problem.


Reply With Quote