aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils/new-utils/src
diff options
context:
space:
mode:
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>2008-08-25 11:21:48 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-08-25 14:38:02 +0300
commitd5184fdeff3bb18e4d5c5fe00a91bd473e4ed26f (patch)
tree37fdb342cfcc81da0ec03347efaef0fa1b51e3de /ubi-utils/new-utils/src
parentc67a5c357443321dd252dceddb8e5304430e47c5 (diff)
ubi-utils: use 'stat(2)' instead of 'lstat(2)'
The UBI tools refuse to work with symlinks like '/dev/ubi/bootloader -> ../ubi0_2' because they use 'lstat(2)' and get information about the symlink but not about the device. This is unwanted and fixed by this patch. This patch renames 'struct stat stat' variables to 'st' to avoid compilation errors. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/new-utils/src')
-rw-r--r--ubi-utils/new-utils/src/libubi.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ubi-utils/new-utils/src/libubi.c b/ubi-utils/new-utils/src/libubi.c
index 8f95108..10e3f2a 100644
--- a/ubi-utils/new-utils/src/libubi.c
+++ b/ubi-utils/new-utils/src/libubi.c
@@ -365,7 +365,7 @@ static int vol_node2nums(struct libubi *lib, const char *node, int *dev_num,
int i, fd, major, minor;
char file[strlen(lib->ubi_vol) + 100];
- if (lstat(node, &st))
+ if (stat(node, &st))
return -1;
if (!S_ISCHR(st.st_mode)) {
@@ -427,20 +427,20 @@ static int vol_node2nums(struct libubi *lib, const char *node, int *dev_num,
*/
static int dev_node2num(struct libubi *lib, const char *node, int *dev_num)
{
- struct stat stat;
+ struct stat st;
struct ubi_info info;
int i, major, minor;
- if (lstat(node, &stat))
+ if (stat(node, &st))
return -1;
- if (!S_ISCHR(stat.st_mode)) {
+ if (!S_ISCHR(st.st_mode)) {
errno = EINVAL;
return errmsg("\"%s\" is not a character device", node);
}
- major = major(stat.st_rdev);
- minor = minor(stat.st_rdev);
+ major = major(st.st_rdev);
+ minor = minor(st.st_rdev);
if (minor != 0) {
errno = EINVAL;
@@ -754,7 +754,7 @@ int ubi_node_type(libubi_t desc, const char *node)
struct libubi *lib = (struct libubi *)desc;
char file[strlen(lib->ubi_vol) + 100];
- if (lstat(node, &st))
+ if (stat(node, &st))
return -1;
if (!S_ISCHR(st.st_mode)) {