Remove double check for ft->mnt_dir and decode_octal.
This commit is contained in:
parent
b3b534c342
commit
b9f1ccd793
@ -5,6 +5,9 @@ ChangeLog for davfs2
|
||||
* mount_davfs.c, check_fstab, get_options, parse_persona:
|
||||
Rename check_persona into parse_persona.
|
||||
Set n_args->uid and n_args->gid in check_fstab.
|
||||
* mount_davfs.c, check_fstab:
|
||||
Remove double check for ft->mnt_dir.
|
||||
Remove unnecessary decode_octal.
|
||||
|
||||
2012-01-15 Werner Baumann (werner.baumann@onlinehome.de)
|
||||
* mount_davfs.c, parse_config, new_args:
|
||||
|
@ -184,9 +184,6 @@ debug_opts(const char *s);
|
||||
static int
|
||||
debug_opts_neon(const char *s);
|
||||
|
||||
static char *
|
||||
decode_octal(const char *s);
|
||||
|
||||
static void
|
||||
delete_args(dav_args *args);
|
||||
|
||||
@ -690,7 +687,7 @@ check_fstab(const dav_args *args)
|
||||
error(EXIT_FAILURE, errno, _("can't open file %s"), _PATH_MNTTAB);
|
||||
|
||||
struct mntent *ft = getmntent(fstab);
|
||||
while (ft && ft->mnt_dir) {
|
||||
while (ft) {
|
||||
if (ft->mnt_dir) {
|
||||
char *mp = canonicalize_file_name(ft->mnt_dir);
|
||||
if (mp) {
|
||||
@ -707,12 +704,8 @@ check_fstab(const dav_args *args)
|
||||
error(EXIT_FAILURE, 0, _("no entry for %s found in %s"), mpoint,
|
||||
_PATH_MNTTAB);
|
||||
|
||||
if (strcmp(url, ft->mnt_fsname) != 0) {
|
||||
char *fstab_url = decode_octal(ft->mnt_fsname);
|
||||
if (strcmp(url, fstab_url) != 0)
|
||||
error(EXIT_FAILURE, 0, _("different URL in %s"), _PATH_MNTTAB);
|
||||
free(fstab_url);
|
||||
}
|
||||
if (strcmp(url, ft->mnt_fsname) != 0)
|
||||
error(EXIT_FAILURE, 0, _("different URL in %s"), _PATH_MNTTAB);
|
||||
|
||||
if (!ft->mnt_type || strcmp(DAV_FS_TYPE, ft->mnt_type) != 0)
|
||||
error(EXIT_FAILURE, 0, _("different file system type in %s"),
|
||||
@ -1480,39 +1473,6 @@ debug_opts_neon(const char *s)
|
||||
}
|
||||
|
||||
|
||||
/* Searches string s for octal encoded characters (like \040 for space).
|
||||
It returns a new string where these have been replaced by the
|
||||
respective characters. */
|
||||
static char *
|
||||
decode_octal(const char *s)
|
||||
{
|
||||
const char *old = s;
|
||||
char *decoded = calloc(strlen(s) +1, 1);
|
||||
if (!decoded) abort();
|
||||
while (*old != '\0') {
|
||||
char *pos = strstr(old, "\\0");
|
||||
if (pos) {
|
||||
char *tail;
|
||||
int c = strtol(pos + 1, &tail, 8);
|
||||
if ((tail - pos) == 4 && c != 0 && c >= CHAR_MIN && c <= CHAR_MAX) {
|
||||
strncat(decoded, old, pos - old);
|
||||
*(decoded + strlen(decoded)) = c;
|
||||
old = tail;
|
||||
} else {
|
||||
pos += 2;
|
||||
strncat(decoded, old, pos - old);
|
||||
old = pos;
|
||||
}
|
||||
} else {
|
||||
strcat(decoded, old);
|
||||
old += strlen(old);
|
||||
}
|
||||
}
|
||||
|
||||
return decoded;
|
||||
}
|
||||
|
||||
|
||||
/* Frees all strings and arrays held by args and finally frees args. */
|
||||
static void
|
||||
delete_args(dav_args *args)
|
||||
|
Loading…
Reference in New Issue
Block a user