cp_grant_id_t label_gid;
size_t label_len;
int r = OK;
- int readonly;
fs_dev = fs_m_in.REQ_DEV;
label_gid = fs_m_in.REQ_GRANT;
label_len = fs_m_in.REQ_PATH_LEN;
- readonly = 1; /* Always mount devices read only. */
if (label_len > sizeof(fs_dev_label))
return(EINVAL);
/* Map the driver label for this major */
bdev_driver(fs_dev, fs_dev_label);
- /* Open the device the file system lives on */
- if (bdev_open(fs_dev, readonly ? R_BIT : (R_BIT|W_BIT)) != OK) {
+ /* Open the device the file system lives on in read only mode */
+ if (bdev_open(fs_dev, R_BIT) != OK) {
return(EINVAL);
}
while(cp[0] == '/')
cp++;
if (cp[0] == '\0') {
- strcpy(string, ".");
+ strlcpy(string, ".", NAME_MAX + 1);
ncp = cp;
}
else
if (len == 0)
{
/* Return "." */
- strcpy(string, ".");
+ strlcpy(string, ".", NAME_MAX + 1);
}
else
{
done = TRUE;
release_dir_record(dir_tmp);
} else { /* The dir record is valid. Copy data... */
- if (dir_tmp->file_id[0] == 0) strcpy(name,".");
- else if (dir_tmp->file_id[0] == 1) strcpy(name,"..");
+ if (dir_tmp->file_id[0] == 0)
+ strlcpy(name, ".", NAME_MAX + 1);
+ else if (dir_tmp->file_id[0] == 1)
+ strlcpy(name, "..", NAME_MAX + 1);
else {
/* Extract the name from the field file_id */
strncpy(name, dir_tmp->file_id,
continue;
}
- strcpy(name_old,name);
+ strlcpy(name_old, name, NAME_MAX + 1);
/* Compute the length of the name */
cp = memchr(name, '\0', NAME_MAX);