mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Flock: container create command confusion rectified
This commit is contained in:
parent
23a3e48db4
commit
17899c0559
@ -362,7 +362,7 @@ container_mainloop(int fd)
|
|||||||
SYSCALL(lstat, orig, &s);
|
SYSCALL(lstat, orig, &s);
|
||||||
if (!(s.st_mode & S_IRWXO))
|
if (!(s.st_mode & S_IRWXO))
|
||||||
{
|
{
|
||||||
log(L_INFO "ignoring unusable device %s", e->d_name);
|
// log(L_INFO "ignoring unusable device %s", e->d_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,7 +373,7 @@ container_mainloop(int fd)
|
|||||||
case S_IFCHR:
|
case S_IFCHR:
|
||||||
case S_IFBLK:
|
case S_IFBLK:
|
||||||
case S_IFREG:
|
case S_IFREG:
|
||||||
log(L_INFO "bindmounting device %s", e->d_name);
|
// log(L_INFO "bindmounting device %s", e->d_name);
|
||||||
SYSCALL(close, SYSCALL(open, path, O_WRONLY | O_CREAT, 0666));
|
SYSCALL(close, SYSCALL(open, path, O_WRONLY | O_CREAT, 0666));
|
||||||
int me = mount(orig, mpnt, NULL, MS_BIND, NULL);
|
int me = mount(orig, mpnt, NULL, MS_BIND, NULL);
|
||||||
if (me < 0)
|
if (me < 0)
|
||||||
@ -386,7 +386,8 @@ container_mainloop(int fd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log(L_INFO "ignoring device %s", e->d_name);
|
// log(L_INFO "ignoring device %s", e->d_name);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1004,7 +1005,7 @@ hcf_parse(byte *buf, int size)
|
|||||||
ctx->target_len = ctx->value;
|
ctx->target_len = ctx->value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: /* workdir */
|
case 3: /* basedir */
|
||||||
if (ctx->type != 3)
|
if (ctx->type != 3)
|
||||||
CBOR_PARSER_ERROR("Expected string, got %u", ctx->type);
|
CBOR_PARSER_ERROR("Expected string, got %u", ctx->type);
|
||||||
|
|
||||||
@ -1012,25 +1013,25 @@ hcf_parse(byte *buf, int size)
|
|||||||
CBOR_PARSER_ERROR("Variable length string not supported yet");
|
CBOR_PARSER_ERROR("Variable length string not supported yet");
|
||||||
|
|
||||||
if (ccf.workdir)
|
if (ccf.workdir)
|
||||||
CBOR_PARSER_ERROR("Duplicate argument 1 / workdir");
|
CBOR_PARSER_ERROR("Duplicate argument 1 / basedir");
|
||||||
|
|
||||||
ASSERT_DIE(!ctx->target_buf);
|
ASSERT_DIE(!ctx->target_buf);
|
||||||
ccf.workdir = ctx->target_buf = lp_alloc(ctx->lp, ctx->value + 1);
|
ccf.basedir = ctx->target_buf = lp_alloc(ctx->lp, ctx->value + 1);
|
||||||
ctx->target_len = ctx->value;
|
ctx->target_len = ctx->value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: /* basedir */
|
case 4: /* workdir */
|
||||||
if (ctx->type != 3)
|
if (ctx->type != 3)
|
||||||
CBOR_PARSER_ERROR("Expected string, got %u", ctx->type);
|
CBOR_PARSER_ERROR("Expected string, got %u", ctx->type);
|
||||||
|
|
||||||
if (ctx->tflags & CPT_VARLEN)
|
if (ctx->tflags & CPT_VARLEN)
|
||||||
CBOR_PARSER_ERROR("Variable length string not supported yet");
|
CBOR_PARSER_ERROR("Variable length string not supported yet");
|
||||||
|
|
||||||
if (ccf.basedir)
|
if (ccf.workdir)
|
||||||
CBOR_PARSER_ERROR("Duplicate argument 1 / basedir");
|
CBOR_PARSER_ERROR("Duplicate argument 2 / workdir");
|
||||||
|
|
||||||
ASSERT_DIE(!ctx->target_buf);
|
ASSERT_DIE(!ctx->target_buf);
|
||||||
ccf.basedir = ctx->target_buf = lp_alloc(ctx->lp, ctx->value + 1);
|
ccf.workdir = ctx->target_buf = lp_alloc(ctx->lp, ctx->value + 1);
|
||||||
ctx->target_len = ctx->value;
|
ctx->target_len = ctx->value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
34
flock/ctl.c
34
flock/ctl.c
@ -188,22 +188,7 @@ hcs_parse(struct hcs_parser_context *htx, const byte *buf, s64 size)
|
|||||||
htx->major_state = 501;
|
htx->major_state = 501;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 504: /* machine creation argument 2: workdir */
|
case 504: /* machine creation argument 2: basedir */
|
||||||
if (ctx->type != 2)
|
|
||||||
CBOR_PARSER_ERROR("Expected bytestring, got %u", ctx->type);
|
|
||||||
|
|
||||||
if (ctx->tflags & CPT_VARLEN)
|
|
||||||
CBOR_PARSER_ERROR("Variable length string not supported yet");
|
|
||||||
|
|
||||||
if (htx->cfg.container.workdir)
|
|
||||||
CBOR_PARSER_ERROR("Duplicate argument 2 / workdir");
|
|
||||||
|
|
||||||
ASSERT_DIE(!ctx->target_buf);
|
|
||||||
htx->cfg.container.workdir = ctx->target_buf = lp_alloc(ctx->lp, ctx->value + 1);
|
|
||||||
ctx->target_len = ctx->value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 505: /* machine creation argument 3: basedir */
|
|
||||||
if (ctx->type != 2)
|
if (ctx->type != 2)
|
||||||
CBOR_PARSER_ERROR("Expected bytestring, got %u", ctx->type);
|
CBOR_PARSER_ERROR("Expected bytestring, got %u", ctx->type);
|
||||||
|
|
||||||
@ -211,13 +196,28 @@ hcs_parse(struct hcs_parser_context *htx, const byte *buf, s64 size)
|
|||||||
CBOR_PARSER_ERROR("Variable length string not supported yet");
|
CBOR_PARSER_ERROR("Variable length string not supported yet");
|
||||||
|
|
||||||
if (htx->cfg.container.basedir)
|
if (htx->cfg.container.basedir)
|
||||||
CBOR_PARSER_ERROR("Duplicate argument 3 / basedir");
|
CBOR_PARSER_ERROR("Duplicate argument 2 / basedir");
|
||||||
|
|
||||||
ASSERT_DIE(!ctx->target_buf);
|
ASSERT_DIE(!ctx->target_buf);
|
||||||
htx->cfg.container.basedir = ctx->target_buf = lp_alloc(ctx->lp, ctx->value + 1);
|
htx->cfg.container.basedir = ctx->target_buf = lp_alloc(ctx->lp, ctx->value + 1);
|
||||||
ctx->target_len = ctx->value;
|
ctx->target_len = ctx->value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 505: /* machine creation argument 3: workdir */
|
||||||
|
if (ctx->type != 2)
|
||||||
|
CBOR_PARSER_ERROR("Expected bytestring, got %u", ctx->type);
|
||||||
|
|
||||||
|
if (ctx->tflags & CPT_VARLEN)
|
||||||
|
CBOR_PARSER_ERROR("Variable length string not supported yet");
|
||||||
|
|
||||||
|
if (htx->cfg.container.workdir)
|
||||||
|
CBOR_PARSER_ERROR("Duplicate argument 3 / workdir");
|
||||||
|
|
||||||
|
ASSERT_DIE(!ctx->target_buf);
|
||||||
|
htx->cfg.container.workdir = ctx->target_buf = lp_alloc(ctx->lp, ctx->value + 1);
|
||||||
|
ctx->target_len = ctx->value;
|
||||||
|
break;
|
||||||
|
|
||||||
case 601: /* machine shutdown argument */
|
case 601: /* machine shutdown argument */
|
||||||
if (ctx->type != 0)
|
if (ctx->type != 0)
|
||||||
CBOR_PARSER_ERROR("Expected integer, got %u", ctx->type);
|
CBOR_PARSER_ERROR("Expected integer, got %u", ctx->type);
|
||||||
|
Loading…
Reference in New Issue
Block a user