##// END OF EJS Templates
chg: forward umask from client to server...
Jun Wu -
r28160:098cb7bd default
parent child Browse files
Show More
@@ -33,6 +33,7 b' enum {'
33 CAP_CHDIR = 0x0200,
33 CAP_CHDIR = 0x0200,
34 CAP_GETPAGER = 0x0400,
34 CAP_GETPAGER = 0x0400,
35 CAP_SETENV = 0x0800,
35 CAP_SETENV = 0x0800,
36 CAP_SETUMASK = 0x1000,
36 };
37 };
37
38
38 typedef struct {
39 typedef struct {
@@ -47,6 +48,7 b' static const cappair_t captable[] = {'
47 {"chdir", CAP_CHDIR},
48 {"chdir", CAP_CHDIR},
48 {"getpager", CAP_GETPAGER},
49 {"getpager", CAP_GETPAGER},
49 {"setenv", CAP_SETENV},
50 {"setenv", CAP_SETENV},
51 {"setumask", CAP_SETUMASK},
50 {NULL, 0}, /* terminator */
52 {NULL, 0}, /* terminator */
51 };
53 };
52
54
@@ -385,6 +387,17 b' static void chdirtocwd(hgclient_t *hgc)'
385 writeblockrequest(hgc, "chdir");
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 * Open connection to per-user cmdserver
402 * Open connection to per-user cmdserver
390 *
403 *
@@ -433,6 +446,8 b' hgclient_t *hgc_open(const char *socknam'
433 attachio(hgc);
446 attachio(hgc);
434 if (hgc->capflags & CAP_CHDIR)
447 if (hgc->capflags & CAP_CHDIR)
435 chdirtocwd(hgc);
448 chdirtocwd(hgc);
449 if (hgc->capflags & CAP_SETUMASK)
450 forwardumask(hgc);
436
451
437 return hgc;
452 return hgc;
438 }
453 }
General Comments 0
You need to be logged in to leave comments. Login now