chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] udev_volume_id: new version of volume_id
[elogind.git]
/
udev_db.c
diff --git
a/udev_db.c
b/udev_db.c
index f2a890ea421c7b3ad8b633a8275727298b5ff405..36da2647165dc0b925c09993aa3ebc1a7916a860 100644
(file)
--- a/
udev_db.c
+++ b/
udev_db.c
@@
-33,7
+33,7
@@
#include "libsysfs/sysfs/libsysfs.h"
#include "udev.h"
#include "libsysfs/sysfs/libsysfs.h"
#include "udev.h"
-#include "udev_
lib
.h"
+#include "udev_
utils
.h"
#include "logging.h"
#include "udev_db.h"
#include "logging.h"
#include "udev_db.h"
@@
-79,7
+79,8
@@
int udev_db_add_device(struct udevice *udev)
fprintf(f, "P:%s\n", udev->devpath);
fprintf(f, "N:%s\n", udev->name);
fprintf(f, "S:%s\n", udev->symlink);
fprintf(f, "P:%s\n", udev->devpath);
fprintf(f, "N:%s\n", udev->name);
fprintf(f, "S:%s\n", udev->symlink);
- fprintf(f, "A:%d\n", udev->partitions);
+ fprintf(f, "A:%u\n", udev->partitions);
+ fprintf(f, "R:%u\n", udev->ignore_remove);
fclose(f);
fclose(f);
@@
-111,21
+112,34
@@
static int parse_db_file(struct udevice *udev, const char *filename)
if (count > DEVPATH_SIZE)
count = DEVPATH_SIZE-1;
strncpy(udev->devpath, &bufline[2], count-2);
if (count > DEVPATH_SIZE)
count = DEVPATH_SIZE-1;
strncpy(udev->devpath, &bufline[2], count-2);
+ udev->devpath[count-2] = '\0';
break;
case 'N':
if (count > NAME_SIZE)
count = NAME_SIZE-1;
strncpy(udev->name, &bufline[2], count-2);
break;
case 'N':
if (count > NAME_SIZE)
count = NAME_SIZE-1;
strncpy(udev->name, &bufline[2], count-2);
+ udev->name[count-2] = '\0';
break;
case 'S':
if (count > NAME_SIZE)
count = NAME_SIZE-1;
strncpy(udev->symlink, &bufline[2], count-2);
break;
case 'S':
if (count > NAME_SIZE)
count = NAME_SIZE-1;
strncpy(udev->symlink, &bufline[2], count-2);
+ udev->symlink[count-2] = '\0';
break;
case 'A':
break;
case 'A':
- strfieldcpy(line, &bufline[2]);
+ if (count > NAME_SIZE)
+ count = NAME_SIZE-1;
+ strncpy(line, &bufline[2], count-2);
+ line[count-2] = '\0';
udev->partitions = atoi(line);
break;
udev->partitions = atoi(line);
break;
+ case 'R':
+ if (count > NAME_SIZE)
+ count = NAME_SIZE-1;
+ strncpy(line, &bufline[2], count-2);
+ line[count-2] = '\0';
+ udev->ignore_remove = atoi(line);
+ break;
}
}
}
}