Show More
@@ -33,6 +33,7 b' enum {' | |||
|
33 | 33 | CAP_CHDIR = 0x0200, |
|
34 | 34 | CAP_GETPAGER = 0x0400, |
|
35 | 35 | CAP_SETENV = 0x0800, |
|
36 | CAP_SETUMASK = 0x1000, | |
|
36 | 37 | }; |
|
37 | 38 | |
|
38 | 39 | typedef struct { |
@@ -47,6 +48,7 b' static const cappair_t captable[] = {' | |||
|
47 | 48 | {"chdir", CAP_CHDIR}, |
|
48 | 49 | {"getpager", CAP_GETPAGER}, |
|
49 | 50 | {"setenv", CAP_SETENV}, |
|
51 | {"setumask", CAP_SETUMASK}, | |
|
50 | 52 | {NULL, 0}, /* terminator */ |
|
51 | 53 | }; |
|
52 | 54 | |
@@ -385,6 +387,17 b' static void chdirtocwd(hgclient_t *hgc)' | |||
|
385 | 387 | writeblockrequest(hgc, "chdir"); |
|
386 | 388 | } |
|
387 | 389 | |
|
390 | static void forwardumask(hgclient_t *hgc) | |
|
391 | { | |
|
392 | mode_t mask = umask(0); | |
|
393 | umask(mask); | |
|
394 | ||
|
395 | static const char command[] = "setumask\n"; | |
|
396 | sendall(hgc->sockfd, command, sizeof(command) - 1); | |
|
397 | uint32_t data = htonl(mask); | |
|
398 | sendall(hgc->sockfd, &data, sizeof(data)); | |
|
399 | } | |
|
400 | ||
|
388 | 401 | /*! |
|
389 | 402 | * Open connection to per-user cmdserver |
|
390 | 403 | * |
@@ -433,6 +446,8 b' hgclient_t *hgc_open(const char *socknam' | |||
|
433 | 446 | attachio(hgc); |
|
434 | 447 | if (hgc->capflags & CAP_CHDIR) |
|
435 | 448 | chdirtocwd(hgc); |
|
449 | if (hgc->capflags & CAP_SETUMASK) | |
|
450 | forwardumask(hgc); | |
|
436 | 451 | |
|
437 | 452 | return hgc; |
|
438 | 453 | } |
General Comments 0
You need to be logged in to leave comments.
Login now