Sponsored Content
Full Discussion: lstat problem
Top Forums Programming lstat problem Post 302481700 by garag11 on Sunday 19th of December 2010 09:29:34 AM
Old 12-19-2010
lstat problem

Hello,
I have a little problem with lstat.
I use the find utility, to find a path for a file in my system.
After that,I take that path and I pass it in lstat, but lstat returns -1, and this error : no such file or directory.
So I m trying to "ls" the path in the shell, but it also fails.

Find returns me for example this: "./.local/share/Trash/files/myfile (4th copy).c"
I remove the dot from the begining,and then i pass this path in lstat but it doesnt work. Maybe the other dots inside the path cause the problem..? Any ideas?
thanx in advance Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl: why the return valure of stat and lstat are the same?

i tried to use stat to get the attributes of a file and a soft link. but the result i got from stat and lstat are the same. say: ln -s f1 soft1 (soft is a soft link , point to f1) if i use > ls -il shows the inode and modify time of soft1 and f1 are different. but the modify... (1 Reply)
Discussion started by: gusla
1 Replies

2. UNIX for Advanced & Expert Users

SSH Problem auth problem

Hi, Just recently we seem to be getting the following error message relating to SSH when we run the UNIX script in background mode: warning: You have no controlling tty. Cannot read confirmation.^M warning: Authentication failed.^M Disconnected; key exchange or algorithm negotiation... (1 Reply)
Discussion started by: budrito
1 Replies

3. Shell Programming and Scripting

Searching for SETUID and SETGID using PERL file find with lstat

About System and Perl: Sun Solaris 5.9 sparc, Perl 5.6.1 I've decided to use the perl file::find module to look for all the SETUID and SETGID files on my unix boxes. I wrote something like this: (I've shorted it a little to make it simple) #!/opt/perl/bin/perl use File::Find; find... (1 Reply)
Discussion started by: x96riley3
1 Replies

4. Programming

lstat long path problem

Hi, We are using lstat in our project. But in case of the path length more than 1024, it's returning error ENAMETOOLONG. Is there any another system call which is supporting more than 1024 path and providing the same info as lstat. Thanks (2 Replies)
Discussion started by: Saurabh78
2 Replies

5. AIX

user login problem & Files listing problem.

1) when user login to the server the session got colosed. How will resolve? 2) While firing the command ls -l we are not able to see the any files in the director. but over all view the file system using the command df -g it is showing 91% used. what will be the problem? Thanks in advance. (1 Reply)
Discussion started by: pernasivam
1 Replies

6. Red Hat

Mail Problem. Maybe, it is a DNS Problem!

Hi, i've a redhat linux 9 upadated by redhat from 7 version to 9 version. A couple of days ago i was a problem with my mail, in other words i'm not able to get any email nor to send any email. I've a proxy configuration and i tried to set iptables in order to verify the port. The 110,255 and 995... (1 Reply)
Discussion started by: pintalgi
1 Replies

7. UNIX for Dummies Questions & Answers

DHCP problem and eth1 problem

At work I am trying to get this one Linux machine (let's call it ctesgm07) to behave like another Linux machine that we have (let's call it test007). test007 returns the following version info: cat /etc/debian_version: lenny/sid uname -a: Linux test007 2.6.27-7-generic #1 SMP Tue Nov 4... (0 Replies)
Discussion started by: sllinux
0 Replies

8. UNIX for Dummies Questions & Answers

lstat problem

Hello, I have a little problem with lstat. I use the find utility, to find a path for a file in my system. After that,I take that path and I pass it in lstat, but lstat returns -1, and this error : no such file or directory. So I m trying to "ls" the path in the shell, but it also fails. ... (2 Replies)
Discussion started by: garag11
2 Replies

9. IP Networking

Problem with forwarding emails (SPF problem)

Hi, This is rather a question from a "user" than from a sys admin, but I think this forum is apropriate for the question. I have an adress with automatic email forwarding and for some senders (two hietherto), emails are bouncing. This has really created a lot of problems those two time so I... (0 Replies)
Discussion started by: carwe
0 Replies

10. UNIX for Dummies Questions & Answers

sed Or Grep Problem OR Terminal Problem?

I don't know if you guys get this problem sometimes at Terminal but I had been having this problem since yesterday :( Maybe I overdid the Terminal. Even the codes that used to work doesn't work anymore. Here is what 's happening: * I wanted to remove lines containing digits so I used this... (25 Replies)
Discussion started by: Nexeu
25 Replies
LSTAT(3P)                                                    POSIX Programmer's Manual                                                   LSTAT(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
lstat - get symbolic link status SYNOPSIS
#include <sys/stat.h> int lstat(const char *restrict path, struct stat *restrict buf); DESCRIPTION
The lstat() function shall be equivalent to stat(), except when path refers to a symbolic link. In that case lstat() shall return informa- tion about the link, while stat() shall return information about the file the link references. For symbolic links, the st_mode member shall contain meaningful information when used with the file type macros, and the st_size member shall contain the length of the pathname contained in the symbolic link. File mode bits and the contents of the remaining members of the stat structure are unspecified. The value returned in the st_size member is the length of the contents of the symbolic link, and does not count any trailing null. RETURN VALUE
Upon successful completion, lstat() shall return 0. Otherwise, it shall return -1 and set errno to indicate the error. ERRORS
The lstat() function shall fail if: EACCES A component of the path prefix denies search permission. EIO An error occurred while reading from the file system. ELOOP A loop exists in symbolic links encountered during resolution of the path argument. ENAMETOOLONG The length of a pathname exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}. ENOTDIR A component of the path prefix is not a directory. ENOENT A component of path does not name an existing file or path is an empty string. EOVERFLOW The file size in bytes or the number of blocks allocated to the file or the file serial number cannot be represented correctly in the structure pointed to by buf. The lstat() function may fail if: ELOOP More than {SYMLOOP_MAX} symbolic links were encountered during resolution of the path argument. ENAMETOOLONG As a result of encountering a symbolic link in resolution of the path argument, the length of the substituted pathname string exceeded {PATH_MAX}. EOVERFLOW One of the members is too large to store into the structure pointed to by the buf argument. The following sections are informative. EXAMPLES
Obtaining Symbolic Link Status Information The following example shows how to obtain status information for a symbolic link named /modules/pass1. The structure variable buffer is defined for the stat structure. If the path argument specified the filename for the file pointed to by the symbolic link ( /home/cnd/mod1), the results of calling the function would be the same as those returned by a call to the stat() function. #include <sys/stat.h> struct stat buffer; int status; ... status = lstat("/modules/pass1", &buffer); APPLICATION USAGE
None. RATIONALE
The lstat() function is not required to update the time-related fields if the named file is not a symbolic link. While the st_uid, st_gid, st_atime, st_mtime, and st_ctime members of the stat structure may apply to a symbolic link, they are not required to do so. No functions in IEEE Std 1003.1-2001 are required to maintain any of these time fields. FUTURE DIRECTIONS
None. SEE ALSO
fstat(), readlink(), stat(), symlink(), the Base Definitions volume of IEEE Std 1003.1-2001, <sys/stat.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 LSTAT(3P)
All times are GMT -4. The time now is 11:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy