summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2014-02-02 15:46:06 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2014-02-02 15:46:06 +0000
commit3be407f055ef87d9fe54b4fd944055f60b580789 (patch)
treef8a6f761fbfe74904e3879fb4ecc17c279d931c4 /app
parentef69f36251088de1a4aad05f5dda61c4930acd81 (diff)
The menu already limits entries with MENU_MAXENTRY, so don't bother
holding a command name limit as well.
Diffstat (limited to 'app')
-rw-r--r--app/cwm/calmwm.h9
-rw-r--r--app/cwm/conf.c12
2 files changed, 10 insertions, 11 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h
index c6f9511b6..4b17075ed 100644
--- a/app/cwm/calmwm.h
+++ b/app/cwm/calmwm.h
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: calmwm.h,v 1.254 2014/01/30 22:17:22 okan Exp $
+ * $OpenBSD: calmwm.h,v 1.255 2014/02/02 15:46:05 okan Exp $
*/
#ifndef _CALMWM_H_
@@ -259,10 +259,9 @@ TAILQ_HEAD(keybinding_q, binding);
TAILQ_HEAD(mousebinding_q, binding);
struct cmd {
- TAILQ_ENTRY(cmd) entry;
-#define CMD_MAXNAMELEN 256
- char name[CMD_MAXNAMELEN];
- char path[MAXPATHLEN];
+ TAILQ_ENTRY(cmd) entry;
+ char *name;
+ char path[MAXPATHLEN];
};
TAILQ_HEAD(cmd_q, cmd);
diff --git a/app/cwm/conf.c b/app/cwm/conf.c
index 26007727b..fb50ed733 100644
--- a/app/cwm/conf.c
+++ b/app/cwm/conf.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: conf.c,v 1.170 2014/01/30 22:17:22 okan Exp $
+ * $OpenBSD: conf.c,v 1.171 2014/02/02 15:46:05 okan Exp $
*/
#include <sys/param.h>
@@ -51,13 +51,11 @@ conf_cmd_add(struct conf *c, const char *name, const char *path)
sizeof(c->lockpath))
return (0);
} else {
- cmd = xmalloc(sizeof(*cmd));
-
conf_cmd_remove(c, name);
- if (strlcpy(cmd->name, name, sizeof(cmd->name)) >=
- sizeof(cmd->name))
- return (0);
+ cmd = xmalloc(sizeof(*cmd));
+
+ cmd->name = xstrdup(name);
if (strlcpy(cmd->path, path, sizeof(cmd->path)) >=
sizeof(cmd->path))
return (0);
@@ -74,6 +72,7 @@ conf_cmd_remove(struct conf *c, const char *name)
TAILQ_FOREACH_SAFE(cmd, &c->cmdq, entry, cmdnxt) {
if (strcmp(cmd->name, name) == 0) {
TAILQ_REMOVE(&c->cmdq, cmd, entry);
+ free(cmd->name);
free(cmd);
}
}
@@ -291,6 +290,7 @@ conf_clear(struct conf *c)
while ((cmd = TAILQ_FIRST(&c->cmdq)) != NULL) {
TAILQ_REMOVE(&c->cmdq, cmd, entry);
+ free(cmd->name);
free(cmd);
}